Ticket #7579 (closed: fixed)

Opened 7 years ago

Last modified 5 years ago

Plot from table when more than one x-column

Reported by: Anders Markvardsen Owned by: Arturs Bekasovs
Priority: major Milestone: Release 3.0
Component: GUI Keywords:
Cc: Blocked By:
Blocking: Tester: Anders Markvardsen

Description

One way of creating a table with two x-columns is

  1. Open MuonAnalysis
  1. Using browse button to select AutoTestData/MUSR00015190.nxs
  1. Go to fitting tab and fit a FlatBackground to this data
  1. Go to Results Table tab and tick at least two Log Value tick-boxes, and the bottom right click Create Table
  1. view the content of the ResultsTable and highlight the first x-column (which has [X1]) and the A0[Y2] column
  1. right click and chose Plot->Scatter

Notice that what is plotted as the x-axis on the scatter plot is not x-column selected

Attachments

createTestTable.py (485 bytes) - added by Arturs Bekasovs 7 years ago.
Script to create a table for testing.

Change History

comment:1 Changed 7 years ago by Anders Markvardsen

  • Component changed from Muon to User Interface

Changed component from Muon to User Interface since this is a general MantidPlot UI bug

comment:2 Changed 7 years ago by Arturs Bekasovs

The reason for the described behavior, is that QtiPlot table are associating a Y column with the closest X column to the left (or to the right if there isn't one on the left). So if we have columns 1[X1] 2[X2] 3[Y2] and we select column 3 to be plotted, it uses 2[X2] as the X column. That's expressed through numbers as well: Y2 uses X2, Y3 uses X3 etc.

Bearing that in mind, the following workaround could be applied: if we want to plot column 3 as Y and column 1 as X in table 1[X1] 2[X2] 3[Y2], we move column 1 to the right (using Table -> Move Right) so the table is now 2[X1] 1[X2] 3[Y2]. When this is done, we select column 3 and plot. Alternatively, plot associations can be used.

This is totally non-obvious, but that's how QtiPlot tables work. Need to talk to Anders and Nick about whether we should change this.

Last edited 7 years ago by Arturs Bekasovs (previous) (diff)

comment:3 Changed 7 years ago by Arturs Bekasovs

  • Status changed from new to inprogress

comment:4 Changed 7 years ago by Arturs Bekasovs

Nick suggested to make it so that if we have a single X column selected together with a Y column, we use it. If there are multiple X columns selected - use the old behavior as fallback. Should be easy to implement.

comment:5 Changed 7 years ago by Arturs Bekasovs

Make addCurves method to ignore columns it shouldn't draw.

Refs #7579

Changeset: b30ded148ecc6bed44b019835acd4248edf74a41

comment:6 Changed 7 years ago by Arturs Bekasovs

Slight refactoring of the method.

Refs #7579

Changeset: c6a1e078ec8dc673e2ef191a755ba142a04efeb0

comment:7 Changed 7 years ago by Arturs Bekasovs

Specify X columns for methods.

Don't use convenience method versions, as this will allow to specify our own X columns later on.

Refs #7579

Changeset: 2ddb81dfc5251cdca8500b7d7e5bf6bbe0addb87

comment:8 Changed 7 years ago by Arturs Bekasovs

Remove some repetitive code.

Refs #7579

Changeset: 3ec7e389e0524a7d98930f4f98bbac5eede0358e

comment:9 Changed 7 years ago by Arturs Bekasovs

If there is a single X column in the list - use it.

Refs #7579

Changeset: 478032b46b6c2e6d4e2259fbe22f398c776e8b77

comment:10 Changed 7 years ago by Arturs Bekasovs

Convenience method to get a list of selected X columns.

Refs #7579

Changeset: 95bcc559c25471140dabb7cf56f5e7e1ef9ee670

comment:11 Changed 7 years ago by Arturs Bekasovs

Pass the whole selection to the method.

And check for multiple X columns selected as well.

Refs #7579

Changeset: ae1be2a93cf49455d224e68a894d917ae3dc38ac

comment:12 Changed 7 years ago by Arturs Bekasovs

Tester:

First, check that the behavior requested in the description is implemented.

Second, download the script attached and run it. It will create a nice table which contains all the different types of columns, so you can check that they are handled correctly. Specifically, please check the following:

  1. Basic functionality - if you select one of the X columns and Y column - the X values are used from the X column you've selected.
  2. If you select more than one X column - an appropriate error is thrown.
  3. If you plot without any X columns selected - the old behavior is used. It means that X2 will be used for Y2, X3 for Y3 and so on.
  4. Select all the columns except one of X columns. Check that X values are right, data points are right, error bars and labels are displayed.

Changed 7 years ago by Arturs Bekasovs

Script to create a table for testing.

comment:13 Changed 7 years ago by Arturs Bekasovs

  • Status changed from inprogress to verify
  • Resolution set to fixed

comment:14 Changed 7 years ago by Anders Markvardsen

  • Status changed from verify to verifying
  • Tester set to Anders Markvardsen

comment:15 Changed 7 years ago by Anders Markvardsen

  • Status changed from verifying to closed

Merge remote-tracking branch 'origin/feature/7579_plot_using_selected_x'

comment:16 Changed 7 years ago by Anders Markvardsen

Tested with both script and description

comment:17 Changed 5 years ago by Stuart Campbell

This ticket has been transferred to github issue 8424

Note: See TracTickets for help on using tickets.