Bug 393215 - Right-clicking on a spreedsheet column to plot data only shows that column option in the drop-down menus for both axis
Summary: Right-clicking on a spreedsheet column to plot data only shows that column op...
Status: RESOLVED FIXED
Alias: None
Product: LabPlot2
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Alexander Semke
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-04-17 08:21 UTC by urcindalo
Modified: 2018-04-20 09:39 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Screenshot 1 showing the issue (1.03 MB, image/png)
2018-04-17 08:27 UTC, urcindalo
Details
Screenshot 2 showing the issue (1.03 MB, image/png)
2018-04-17 08:28 UTC, urcindalo
Details

Note You need to log in before you can comment on or make changes to this bug.
Description urcindalo 2018-04-17 08:21:31 UTC
When I right click on a spreedsheet column, like a Y-designated-column, to plot the data, labplot shows just that column as the only option for both axis, i.e., it just shows column number 2 in the drop-down menus to select which data columns are to be plotted for x and y. Later on you can correct that.
Comment 1 urcindalo 2018-04-17 08:27:36 UTC
Created attachment 112064 [details]
Screenshot 1 showing the issue

Screenshot 1 showing the issue
Comment 2 urcindalo 2018-04-17 08:28:20 UTC
Created attachment 112065 [details]
Screenshot 2 showing the issue
Comment 3 Alexander Semke 2018-04-17 09:58:07 UTC
(In reply to urcindalo from comment #0)
> When I right click on a spreedsheet column, like a Y-designated-column, to
> plot the data, labplot shows just that column as the only option for both
> axis, i.e., it just shows column number 2 in the drop-down menus to select
> which data columns are to be plotted for x and y. Later on you can correct
> that.
The plot data dialog shows only the selected columns or shows all columns if no selection is available. This supports two different workflows:
1. the user has one x column and several y columns but wants to plot only couple of them. For this the user does a multiple selection and selects the x column together with the y columns he/she is interested in.
2. the user want to plot all the data available in the spreadsheet. For this the user selects "Plot data" from the context menu of the spreadsheet (no need to select any columns). Here, the first column in the spreadsheet having the plot designation X is assigned as the x column and all the other columns are put to y columns.
Comment 4 urcindalo 2018-04-17 10:39:46 UTC
(In reply to Alexander Semke from comment #3)
> (In reply to urcindalo from comment #0)
> > When I right click on a spreedsheet column, like a Y-designated-column, to
> > plot the data, labplot shows just that column as the only option for both
> > axis, i.e., it just shows column number 2 in the drop-down menus to select
> > which data columns are to be plotted for x and y. Later on you can correct
> > that.
> The plot data dialog shows only the selected columns or shows all columns if
> no selection is available. This supports two different workflows:
> 1. the user has one x column and several y columns but wants to plot only
> couple of them. For this the user does a multiple selection and selects the
> x column together with the y columns he/she is interested in.
> 2. the user want to plot all the data available in the spreadsheet. For this
> the user selects "Plot data" from the context menu of the spreadsheet (no
> need to select any columns). Here, the first column in the spreadsheet
> having the plot designation X is assigned as the x column and all the other
> columns are put to y columns.

Yes, I already checked that. However, in 1. above, if a user is interested in plotting just one y-column, I find it intuitive to *only* select this particular column and expect LabPlot to automatically select its designated x counterpart, not itself as the x-axis.

What's more. Imagine you wanted to plot a y-column from one spreedsheet vs. an x-column from *a different* spreedsheet. I think LabPlot should show the designated x-columns from the available spreedsheets in the drop-down menu when you just select one y-column and right-click on it to plot the data. Or, at the very list, as I said before, its corresponding correct x-colun instead of itself.
Comment 5 Alexander Semke 2018-04-17 11:52:28 UTC
(In reply to urcindalo from comment #4)
> 
> Yes, I already checked that. However, in 1. above, if a user is interested
> in plotting just one y-column, I find it intuitive to *only* select this
> particular column and expect LabPlot to automatically select its designated
> x counterpart, not itself as the x-axis.
Ok, I see. But how can we figure out what is its x counterpart? User can have in principle an arbitrary mixture of plot designations for different columns in the spreadsheet maintained. And the only thing that we have at the moment is the plot designation for the column itself, if provided by the user at all. For example, if the user has the following columns

x y y x

and selects the third column for the plot, what is its x counter part?



> What's more. Imagine you wanted to plot a y-column from one spreedsheet vs.
> an x-column from *a different* spreedsheet. I think LabPlot should show the
> designated x-columns from the available spreedsheets in the drop-down menu
> when you just select one y-column and right-click on it to plot the data.
> Or, at the very list, as I said before, its corresponding correct x-colun
> instead of itself.
With plotting of data via the context menu of the spreadsheet you have an easy tool to quickly plot the data, but for this particular spreadsheet only. If we would show also other spreadsheets in this dialog, this will cause confusions in many cases. If you want to plot data from different spreadsheets you need to manually create a plot, add a xy-curve and provide the column data sources.

Also similar to the arguments above, we don't have the information about "its corresponding x or y column", that's why we cannot do any magic here. Even if we would allow the user to enter for every column the additional information about the corresposding x/y columns, the user has to maintain this which will result in additional overhead.
Comment 6 urcindalo 2018-04-17 16:23:27 UTC
(In reply to Alexander Semke from comment #5)
> (In reply to urcindalo from comment #4)
> > 
> > Yes, I already checked that. However, in 1. above, if a user is interested
> > in plotting just one y-column, I find it intuitive to *only* select this
> > particular column and expect LabPlot to automatically select its designated
> > x counterpart, not itself as the x-axis.
> Ok, I see. But how can we figure out what is its x counterpart? User can
> have in principle an arbitrary mixture of plot designations for different
> columns in the spreadsheet maintained. And the only thing that we have at
> the moment is the plot designation for the column itself, if provided by the
> user at all. For example, if the user has the following columns
> 
> x y y x
> 
> and selects the third column for the plot, what is its x counter part?
> 
> 
> 
> > What's more. Imagine you wanted to plot a y-column from one spreedsheet vs.
> > an x-column from *a different* spreedsheet. I think LabPlot should show the
> > designated x-columns from the available spreedsheets in the drop-down menu
> > when you just select one y-column and right-click on it to plot the data.
> > Or, at the very list, as I said before, its corresponding correct x-colun
> > instead of itself.
> With plotting of data via the context menu of the spreadsheet you have an
> easy tool to quickly plot the data, but for this particular spreadsheet
> only. If we would show also other spreadsheets in this dialog, this will
> cause confusions in many cases. If you want to plot data from different
> spreadsheets you need to manually create a plot, add a xy-curve and provide
> the column data sources.
> 
> Also similar to the arguments above, we don't have the information about
> "its corresponding x or y column", that's why we cannot do any magic here.
> Even if we would allow the user to enter for every column the additional
> information about the corresposding x/y columns, the user has to maintain
> this which will result in additional overhead.

I see. Maybe I'm too spoiled by QtiPlot :)
In QtiPlot you know exactly which x corresponds to a y because it works this way:
a) By default, the first column in any spreedsheet is marked as "x" and the second as "y". Then, every column you add is marked by default as "y", so its corresponding "x" is still the first one in the spreedsheet. No confusion.
b) But, let's say the fifth column is marked also as "x". Then, automatically, the first column is marked as "x1" and all the columns to its right as "y1" until the 5th one, which is now "x2" and all the additional columns you might add to its right will be "y2".

In the end, you just have to select the "y" column you want to plot and the programs selects its "x" accordingly. It's very convenient.

Maybe this idea could be implemented in LabPlot in a future?

Nevertheless, I still think the current behavior is a bug, because if you only have one spreedsheet with only two columns, one clearly marked as "x" and the other as "y" in it, even if you just select the "y" column, right-click on it and select plot, the column marked as "x" in the spreedsheet should appear as an option for the x axis in the corresponding drop-down menu, as is the case when the user selects "Plot data" from the context menu of the spreadsheet without previously selecting any column.
Comment 7 Alexander Semke 2018-04-17 16:30:42 UTC
(In reply to urcindalo from comment #6)
> I see. Maybe I'm too spoiled by QtiPlot :)
> In QtiPlot you know exactly which x corresponds to a y because it works this
> way:
> a) By default, the first column in any spreedsheet is marked as "x" and the
> second as "y". Then, every column you add is marked by default as "y", so
> its corresponding "x" is still the first one in the spreedsheet. No
> confusion.
> b) But, let's say the fifth column is marked also as "x". Then,
> automatically, the first column is marked as "x1" and all the columns to its
> right as "y1" until the 5th one, which is now "x2" and all the additional
> columns you might add to its right will be "y2".
We don't have this x1, etc. I don't think qtiplot has this explicitly, neither. Maybe you meant this symbolically. But I got your idea - the corresponding x counterpart is the first x column to the left of the selected y column. This is easy to get. I'll push a fix for this soon.
Comment 8 urcindalo 2018-04-17 16:50:09 UTC
(In reply to Alexander Semke from comment #7)
> (In reply to urcindalo from comment #6)
> > I see. Maybe I'm too spoiled by QtiPlot :)
> > In QtiPlot you know exactly which x corresponds to a y because it works this
> > way:
> > a) By default, the first column in any spreedsheet is marked as "x" and the
> > second as "y". Then, every column you add is marked by default as "y", so
> > its corresponding "x" is still the first one in the spreedsheet. No
> > confusion.
> > b) But, let's say the fifth column is marked also as "x". Then,
> > automatically, the first column is marked as "x1" and all the columns to its
> > right as "y1" until the 5th one, which is now "x2" and all the additional
> > columns you might add to its right will be "y2".
> We don't have this x1, etc. I don't think qtiplot has this explicitly,
> neither. Maybe you meant this symbolically. But I got your idea - the
> corresponding x counterpart is the first x column to the left of the
> selected y column. This is easy to get. I'll push a fix for this soon.

Thanks! It will be a nice improvement for LabPlot, imho.
Comment 9 Alexander Semke 2018-04-19 07:24:52 UTC
(In reply to urcindalo from comment #8)
> 
> Thanks! It will be a nice improvement for LabPlot, imho.
I added now some logic to automatically recognize the corresponding X-column. For you example with "x y" and only the y-column being selected this will work now. Please give it a try. However, it won't give the user the desired results if we have something like

x y x y y y x y y_err

and similar constellations. If the user wants to plot here everything, we'll have problems. We need to refactor this part in LabPlot and to also decide what to do with the comboboxes we show now in the Plot Data dialog - the logic behind these comboboxes always assumes there is only one x-column and all the other columns are y-columns...
Comment 10 urcindalo 2018-04-19 11:07:13 UTC
(In reply to Alexander Semke from comment #9)
> (In reply to urcindalo from comment #8)
> > 
> > Thanks! It will be a nice improvement for LabPlot, imho.
> I added now some logic to automatically recognize the corresponding
> X-column. For you example with "x y" and only the y-column being selected
> this will work now. Please give it a try. However, it won't give the user
> the desired results if we have something like
> 
> x y x y y y x y y_err
> 
> and similar constellations. If the user wants to plot here everything, we'll
> have problems. We need to refactor this part in LabPlot and to also decide
> what to do with the comboboxes we show now in the Plot Data dialog - the
> logic behind these comboboxes always assumes there is only one x-column and
> all the other columns are y-columns...

Thanks!
Yes, it works now.
Your efforts are greatly appreciated.
Comment 11 Alexander Semke 2018-04-20 09:39:08 UTC
(In reply to urcindalo from comment #10)
> Thanks!
> Yes, it works now.
> Your efforts are greatly appreciated.
Thanks for the checking. I created a task https://phabricator.kde.org/T8559 to track the further improvements in this area in future. Let me close this bug report now.