我想在图例中显示行标签的文本,但也不是一行(如下图所示):

我试图最小化图例的线条和标签,并且也只覆盖新标签(如下面的代码所示).但是,这个传奇带来了两个回归.
legend = ax.legend(loc=0, shadow=False)
for label in legend.get_lines():
label.set_linewidth(0.0)
for label in legend.get_texts():
label.set_fontsize(0)
ax.legend(loc=0, title='New Title')
Run Code Online (Sandbox Code Playgroud) 当我绘制完整数据工作正常并在x轴上显示日期时:
.
当我放大特定部分来查看:
情节只显示时间而不是日期,我明白用较少的点不能显示不同的日期,但即使图形被缩放,如何显示日期或设置日期格式?
dataToPlot = pd.read_csv(fileName, names=['time','1','2','3','4','plotValue','6','7','8','9','10','11','12','13','14','15','16'],
sep=',', index_col=0, parse_dates=True, dayfirst=True)
dataToPlot.drop(dataToPlot.index[0])
startTime = dataToPlot.head(1).index[0]
endTime = dataToPlot.tail(1).index[0]
ax = pd.rolling_mean(dataToPlot_plot[startTime:endTime][['plotValue']],mar).plot(linestyle='-', linewidth=3, markersize=9, color='#FECB00')
Run Code Online (Sandbox Code Playgroud)
提前致谢!
我朋友在Git存储库中的项目,下载了'Git-1.9.4-preview20140929.exe'并安装了GIT bash将项目拉到我的最后,我用它做了
$ git clone <with SSH clone URL>
Run Code Online (Sandbox Code Playgroud)
我在我的本地系统中得到了这个项目,现在我做了一些改动,我想把更改推回到存储库,所以我做了
$ git init
Reinitialized existing Git repository in c:/users....
Run Code Online (Sandbox Code Playgroud)
和
$ git add .
$ pom.xml
./pom.xml: line 1: project: No such file or directory
./pom.xml: line 2: syntax error near unexpected token `newline'
./pom.xml: line 2: ` xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http
://maven.apache.org/maven-v4_0_0.xsd">'
Run Code Online (Sandbox Code Playgroud)
和
$ git commit -m 'First commit'
On branch master
Your branch is ahead of 'origin/master' by 2 commits.
(use "git push" to publish your local commits)
nothing to …Run Code Online (Sandbox Code Playgroud) 基本上我想在点击"生成PDF记录簿"按钮的过程中更改JLabel的标签文本

从前面的例子说:
label.setText("new value");
Run Code Online (Sandbox Code Playgroud)
当我这样做时,标签值根本没有变化,请给我一些指示,谢谢
初始化();
JLabel lblNewLabel = new JLabel("513 k bytes");
lblNewLabel.setBounds(407, 713, 151, 14);
frmViperManufacturingRecord.getContentPane().add(lblNewLabel);
Run Code Online (Sandbox Code Playgroud)
在" 生成PDF记录簿"按钮上单击
JButton btnGeneratePdfHeader = new JButton("Generate PDF Record Book");
btnGeneratePdfHeader.setMnemonic('G');
btnGeneratePdfHeader.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
final JLabel lblNewLabel = new JLabel("513 k bytes");
//java.io.File file = new java.io.File(strdfile);
//lblNewLabel.setSize(file.length());
//System.out.println(file.length());
String fileSize = file.length() + " k bytes";
System.out.println("I am here");
lblNewLabel.setText("new value");
}
});
Run Code Online (Sandbox Code Playgroud) 我希望在应用程序前面显示警告showConfirmDialog窗口,即使GUI移动到不同的位置,如果我不移动应用程序并按"关闭ALT + X"按钮,但是如果我将应用程序移动到第二个屏幕,它可以正常工作警告showConfirmDialog窗口停留在旧位置,如何随GUI一起移动警告窗口,请给我指示,谢谢.
关闭ALT + X按钮
//close window button
JButton btnCloseWindow = new JButton("Close ALT+X");
btnCloseWindow.setMnemonic('x');
btnCloseWindow.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
JFrame frame = new JFrame();
int result = JOptionPane.showConfirmDialog(frame, "Are you sure you want to close the application?", "Please Confirm",JOptionPane.YES_NO_OPTION);
//find the position of GUI and set the value
//dialog.setLocation(10, 20);
if (result == JOptionPane.YES_OPTION)
System.exit(0);
}
});
Run Code Online (Sandbox Code Playgroud)
到目前为止,我试图将GUI的位置设置为showConfirmDialog,但是没有用.
我试图创建一个使用数组元素的段落将其写入pdf文件,如果我只添加一行例如paragraph.add("这是内容"); 工作正常;
当我尝试使用数组时,它会出错 
请给我指示解决这个问题,谢谢.
代码:
public void readStuff(){
String[] arrayName = new String[7];
try{
PdfReader reader = new PdfReader(new FileInputStream("My First PDF Doc.pdf"));
arrayName[0] = "PDF version: " + reader.getPdfVersion();
arrayName[1] = "Number of pages " + reader.getNumberOfPages();
arrayName[2] = "File length: " + reader.getFileLength();
arrayName[3] = "Is it encrypted: " + reader.isEncrypted();
arrayName[4] = "Width of the page 1: " + reader.getPageSize(1).getWidth();
arrayName[5] = "Height of the page 1: " + reader.getPageSize(1).getHeight();
arrayName[6] = "Rotation of page 1: …Run Code Online (Sandbox Code Playgroud) 我设法到目前为止使用stackoverflow示例,JTree显示所有系统驱动器和文件夹,想要显示文件夹中的所有相应文件,得到循环中的所有文件名需要添加它们,这就是我卡住的地方!
请指教我添加文件夹下的文件,谢谢!
码:
public class viewGui extends JFrame {
private FileSystemView fileSystemView;
private Desktop desktop;
private static final long serialVersionUID = 1083130296343096642L;
public static JTree tree;
private DefaultTreeModel treeModel;
private JTable table;
private ListSelectionListener listSelectionListener;
private static final LayoutManager H = new GridLayout(1, 0);
private static final LayoutManager V = new GridLayout(0, 1);
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
try {
viewGui mainWindow = new viewGui();
mainWindow.setVisible(true);
} catch (Exception …Run Code Online (Sandbox Code Playgroud) 有一个简单的JTable,从编辑后尝试获取最新的列值.
"将文件添加到表"按钮将把文件名和路径从JTextField加载到JTable中
"从表中获取值"按钮将(尝试)获取JTable中的所有列值.
编辑完最后一列后按"从表中获取值"按钮只返回前三列而不是编辑列,最后一列不返回任何内容!
如何获取编辑的列值?
码
import java.awt.EventQueue;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTextField;
import javax.swing.JButton;
import javax.swing.JTable;
import javax.swing.table.DefaultTableModel;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.io.File;
import java.nio.file.Path;
import java.util.Vector;
public class viewTable {
private JFrame frame;
private JTextField textField;
private JTable table;
private static DefaultTableModel model;
private static File file;
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
viewTable window = new viewTable();
window.frame.setVisible(true);
} catch (Exception e) { …Run Code Online (Sandbox Code Playgroud)