ebranlard / pyDatView

A crossplatform GUI to plot tabulated data from files (e.g. CSV, Excel, OpenFAST, HAWC2, Flex...), or python pandas dataframes
MIT License
110 stars 43 forks source link

how do I drag the Wind turbines number column directly into the legend? #121

Closed Damen957 closed 2 years ago

Damen957 commented 2 years ago

how do I drag the Wind turbines number column directly into the legend? when drawing the wind speed power curve, otherwise each Wind turbines needs to be read as a tables

ebranlard commented 2 years ago

Hi @Damen957, I'm not sure I understand your question, could you maybe enclose a screenshot of what you see and describe your usage in more details? Are you using the command pydatview.show() or the GUI?

In #120, I've introduced a way to "name" the dataframes that you pass to pydatview.show(). When filenames are passed, the names of the tables are inferred from the filenames. We could add an option to override them though.

Keep me in touch.

Damen957 commented 2 years ago

嗨,@Damen957,我不确定我是否理解您的问题,您能否附上您所看到的屏幕截图并更详细地描述您的使用情况?您使用的是命令还是 GUI?pydatview.show()

在 #120 中,我介绍了一种“命名”传递给 的数据帧的方法。传递文件名时,表的名称是从文件名推断出来的。不过,我们可以添加一个选项来覆盖它们。pydatview.show()

与我保持联系。

duk is the wind turbine number, how to put all the wind turbine numbers into the legend, so that each wind turbine shows a curve ![Uploading 1658807638359.png…]()

Damen957 commented 2 years ago

1658807638359

ebranlard commented 2 years ago

Currently, pyDatView has some logic that decides whether or not the legend is shown.

The legend is not shown when only one signal is present on a plot. If you select two signals, then the signal names will show up in the legend. To select multiple signals you can use the Ctrl or Shift keys,

If you have multiple tables (if you open multiple files), and you select these multiple tables, then the name of the tables will show in the legend.

But maybe your problem is different. Are you maybe trying to split a signal based on the value of another signal? For instance you have two signals:

   power  =[6., 7., 7., 6., 4., 5., 5., 4., 3.]      
   turbine=[1 , 1 , 1 , 1 , 2 , 2 , 2 , 2 ,2 ]  # indices used to identify unique signals

Are you trying to split the power signal into two signals based on the index stored in turbine, as follows?

  power1 = [6, 7., 7., 6.]
  power2 = [4., 5., 5., 4., 3.]

There is no easy way to do that at the moment, but it could be added as a tool somehow.

Keep me in touch!

Damen957 commented 2 years ago

目前,pyDatView有一些逻辑来决定是否显示图例。

当图上仅存在一个信号时,不会显示图例。如果选择两个信号,则信号名称将显示在图例中。要选择多个信号,您可以使用 Ctrl 或 Shift 键,

如果您有多个表(如果打开多个文件),并且您选择了这些多个表,则表的名称将显示在图例中。

但也许你的问题不同。您是否可能尝试根据另一个信号的值拆分一个信号?例如,您有两个信号:

   power  =[6., 7., 7., 6., 4., 5., 5., 4., 3.]      
   turbine=[1 , 1 , 1 , 1 , 2 , 2 , 2 , 2 ,2 ]  # indices used to identify unique signals

您是否尝试根据 中存储的索引将信号拆分为两个信号,如下所示?power``turbine

  power1 = [6, 7., 7., 6.]
  power2 = [4., 5., 5., 4., 3.]

目前没有简单的方法来做到这一点,但它可以以某种方式添加为工具。

与我保持联系!

OK,thanks.