Ticket #9252 (closed: fixed)
Improve plot axis formatting
Reported by: | Martyn Gigg | Owned by: | Martyn Gigg |
---|---|---|---|
Priority: | major | Milestone: | Release 3.2 |
Component: | GUI | Keywords: | CORE |
Cc: | Blocked By: | ||
Blocking: | #8923 | Tester: | Peter Peterson |
Description (last modified by Martyn Gigg) (diff)
Our current plot axes are formatted as
Time-of-flight / microsecond
whereas it is more standard to format them as
Time-of-flight (microsecond)
using brackets to separate the units.
The units themselves should also be formatted using greek letters and superscripts where possible, e.g
Time-of-flight (μs) Energy (cm⁻¹)
Attachments
Change History
comment:2 Changed 7 years ago by Martyn Gigg
Export Unit::utf8Label to Python.
It returns a standard Python unicode string. Refs #9252
Changeset: fffb57e0c422f2e0f52a34dba61e1750559b0c22
comment:5 Changed 7 years ago by Martyn Gigg
- Status changed from assigned to inprogress
Add methods to create X/Y axis labels to WorkspaceData classes
All of the data should have meaningful units so it makes sense to tie them together. Refs #9252
Changeset: 030ee4fb02e8c04f974f33325e781975e96bac06
comment:6 Changed 7 years ago by Martyn Gigg
Use new utf8Label methods for X axis of 1D MatrixWorkspace graphs
Refs #9252
Changeset: 76d06d3b9c0f108387ec9e7a540f549541ac5de4
comment:7 Changed 7 years ago by Martyn Gigg
Add UnitLabel base class.
It will be used to store label information for units. Refs #9252
Changeset: 6da703fd89afba0f93704b74c29aa1a57b9cf06e
comment:8 Changed 7 years ago by Martyn Gigg
Tidy up of Unit.h to remove unirequired headers
Refs #9252
Changeset: 647e90057cee3f83bca0c4d27452bf39ad037a30
comment:9 Changed 7 years ago by Martyn Gigg
Add some basic UnitLabel concrete types.
Refs #9252
Changeset: 393496989a0b9b46c7a6ca01cb0e06d89ba08cb6
comment:10 Changed 7 years ago by Martyn Gigg
Implement & test copy constructor/assignment operator.
Refs #9252
Changeset: a764967c26be558e2d9774529fdb8fea3aa6931c
comment:11 Changed 7 years ago by Martyn Gigg
Add UnitLabel classes for each defined unique Unit class label.
Refs #9252
Changeset: 0cbe00abd6f107c50fb0f67b3d67d60a9dc6416e
comment:12 Changed 7 years ago by Martyn Gigg
Simplify UnitLabel class by just storing attributes.
It makes it easier to use. Refs #9252
Changeset: 3f2d4da45b58c3603aa465e0b23535d1187f4e07
comment:13 Changed 7 years ago by Martyn Gigg
Simplify how unit labels are used/stored in the Unit classes.
Refs #9252
Changeset: 200e4caa9b7c72c1450abef6039510e58a9ff116
comment:14 Changed 7 years ago by Martyn Gigg
Add a PlotAxis class.
It will handle creating axis titles for a given workspace. This keeps information in a single place. Refs #9252
Changeset: 8286acd1a8f15bff65c1c505e3707511b2b38dc5
comment:15 Changed 7 years ago by Martyn Gigg
Harmonise code for X axis title creation.
Refs #9252
Changeset: 120a4bd46259241aeb7b0b1d63661671b72a4dcf
comment:16 Changed 7 years ago by Martyn Gigg
Harmonise code to create a title for "Y" values in a workspace.
Refs #9252
Changeset: e9c93db4edaa9fb10b6b12c24df14ad1f6f60d1d
comment:17 Changed 7 years ago by Martyn Gigg
Use PlotAxis class for spectrogram plots.
Refs #9252
Changeset: dfe9719203e52df453e5f2e3168bd5634c068d8d
comment:18 Changed 7 years ago by Martyn Gigg
Add str & unicode conversion methods to UnitLabel in Python.
Refs #9252
Changeset: 708707de37ea5cdf60e91c42b607ff9d20f1f124
comment:19 Changed 7 years ago by Martyn Gigg
Add UnitLabel inequality operators plus tests
Refs #9252
Changeset: b09f38eecd3657e8a07c4b78f7247acde2d9684f
comment:20 Changed 7 years ago by Martyn Gigg
Allow PlotAxis to use IMDDimension objects alone.
Also put the "Spectrum" label as a Label unit in SpectraAxis Refs #9252
Changeset: de1cc4be7f035a269f56d09b7d1994336b87ba66
comment:21 Changed 7 years ago by Martyn Gigg
Harmonize creation of plot axis titles for MD & nonMD sources.
Refs #9252
Changeset: a8c83050403d0f9092496d0ce288b59849e934a4
comment:22 Changed 7 years ago by Martyn Gigg
Put back methods to return plain strings for unit labels in Python
The main Unit::label is deprecated and issues a warnings but scripts won't break Refs #9252
Changeset: 531226a7853c1a9f9bf184d865c256c121242126
comment:23 Changed 6 years ago by Martyn Gigg
Add an include for gcc 4.4. Refs #9252
Changeset: 7c9773a9591c9aec4c2b7de8a42aab10309678ef
comment:24 Changed 6 years ago by Martyn Gigg
Add missing dll macros for unit classes.
Refs #9252
Changeset: 1c8be6fe284ff5bf7e8fd8c421606569f8b1c8be
comment:25 Changed 6 years ago by Martyn Gigg
Fix SpectraAxis & SaveDave unit tests.
Refs #9252
Changeset: 9e16b494853ccebf90c91901af88d3a4b83a29ad
comment:26 Changed 6 years ago by Martyn Gigg
Add export for template instantion on MSVC
Refs #9252
Changeset: e52399543e38d65e3dc62cbbc9b668aff76e625e
comment:27 Changed 6 years ago by Martyn Gigg
Remove instantiation of specialized template.
Refs #9252
Changeset: 035797c44acad9a0ae86073e23f487ac46724877
comment:28 Changed 6 years ago by Martyn Gigg
Fix a couple of warnings in UnitTest.h
Refs #9252
Changeset: 8c3e8cb86a56525e2386118eb76857ae173a5174
comment:29 Changed 6 years ago by Martyn Gigg
Add windows compiler flag to not treat wchar as built in.
This is required for the QString::fromStdWString type methods to work and seems to have no ill effect. Refs #9252
Changeset: 923712ce3cdc66db5baff21598b84e5fedf02be1
comment:30 Changed 6 years ago by Martyn Gigg
Use QString::fromWCharArray instead of QString::fromUtf8
On gcc a standard c-style string can actually handle utf-8 character codepoints whereas on MSVC we have to explicitly use a wchar array. Refs #9252
Changeset: 96a461ac6d5907c03cf9c21735de43e101f99b56
comment:31 Changed 6 years ago by Martyn Gigg
- Status changed from inprogress to verify
- Keywords CORE added
- Resolution set to fixed
Branch: feature/9252_plot_axes_formatting
Tester: I have attached a script that generates plots from different types of workspace. I suggest running the script in a version without the changes and then comparing the plots with that after the changes.
The main changes are to allow the use of a wider variety of characters, including greek symbols and superscripts etc, for the unit labels on the axes. There is a new class MantidQtAPI::PlotAxis that is now responsible generating the titles for axes on graphs so that the code isn't scattered all over the place. It is also unit tested.
Please play with the graphing in general and make sure I haven't broken anything.
comment:32 Changed 6 years ago by Martyn Gigg
- Summary changed from Format plot axes correctly to Improve plot axis formatting
comment:33 Changed 6 years ago by Karl Palmen
- Status changed from verify to verifying
- Tester set to Karl Palmen
comment:34 Changed 6 years ago by Karl Palmen
- Status changed from verifying to reopened
- Resolution fixed deleted
A check with AutoTestData/emu00006473.nxs showed x-axis "Time (microseconds)" when spectrum was plotted. This ticket will be reopened to investigate this.
comment:35 Changed 6 years ago by Martyn Gigg
- Status changed from reopened to inprogress
Use UnitLabel class in muon loaders.
This gives the utf-8 symbols for the X-axis units. Refs #9252
Changeset: 4f13dfa0850cb4867b21a267e58e37f412f80373
comment:36 Changed 6 years ago by Martyn Gigg
Add the missing DLLExport/Import macro.
Refs #9252
Changeset: 0385dddea06b4c9e84addd90d1c1ef450d7d3e1e
comment:37 Changed 6 years ago by Martyn Gigg
Fix the Python Label::setLabel export after signature change.
Refs #9252
Changeset: fd688b21f09c897408e706fce9430771f8b36084
comment:38 Changed 6 years ago by Martyn Gigg
- Status changed from inprogress to verify
- Resolution set to fixed
So it turned out that the muon loaders use a custom Label unit that can contain any text it wants. I've updated it to use the new UnitLabel class in order to gain the better symbol formatting.
comment:39 Changed 6 years ago by Vickie Lynch
- Status changed from verify to verifying
- Tester changed from Karl Palmen to Vickie Lynch
comment:40 Changed 6 years ago by Vickie Lynch
- Status changed from verifying to verify
- Tester Vickie Lynch deleted
comment:41 Changed 6 years ago by Karl Palmen
- Status changed from verify to verifying
- Tester set to Karl Palmen
comment:42 Changed 6 years ago by Karl Palmen
Testing abandoned because of non-trivial merge conflicts in unit.h when attempting git test start.
comment:43 Changed 6 years ago by Karl Palmen
- Status changed from verifying to reopened
- Resolution fixed deleted
comment:44 Changed 6 years ago by Martyn Gigg
Merge remote-tracking branch 'origin/master' into feature/9252_plot_axes_formatting
Conflicts:
Code/Mantid/Framework/Kernel/inc/MantidKernel/Unit.h Code/Mantid/MantidQt/API/CMakeLists.txt
Refs #9252
comment:45 Changed 6 years ago by Martyn Gigg
- Status changed from reopened to verify
- Resolution set to fixed
I've merged master to to the branch and dealt with the conflicts.
A new merge to master should now be clean.
comment:47 Changed 6 years ago by Karl Palmen
- Status changed from verifying to reopened
- Resolution fixed deleted
I'm unable to merge to master because of merge problems with unit.h and API/CMakeLists.txt .
comment:49 Changed 6 years ago by Martyn Gigg
- Status changed from inprogress to verify
- Resolution set to fixed
Those have already been fixed. Your local copy of the branch must be out of date.
comment:50 Changed 6 years ago by Peter Peterson
- Status changed from verify to verifying
- Tester changed from Karl Palmen to Peter Peterson
comment:51 Changed 6 years ago by Pete Peterson
- Status changed from verifying to closed
Merge remote-tracking branch 'origin/feature/9252_plot_axes_formatting'
Full changeset: 1c62e1ac8c9940db0c542600c024c45a2afd98aa
comment:52 Changed 5 years ago by Stuart Campbell
This ticket has been transferred to github issue 10095
Add a utf8Label method to the Unit class.
This allows the unit to return a wide string containing unicode character encodings, giving more flexibility in how units are presented. Refs #9252
Changeset: 279a4ccd4047bbdbd645e2d32b80ac2163de0be3