Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor pyqtgraph plotting improvements #27

Merged
merged 26 commits into from
Feb 11, 2016
Merged

Minor pyqtgraph plotting improvements #27

merged 26 commits into from
Feb 11, 2016

Conversation

AdriaanRol
Copy link
Contributor

In the spirit of keeping pull-requests small and quick I have decided to send a pull request for my changes to plotting.

I have focused only on 3D (heatmap) plotting

This pull request changes the following

  • Added clear() function to QtPlot
  • Added option to specify axis labels in **kwargs
  • Added option to specify title for a pyqtgraph window
  • changed colormaps to lowercase to be consistent with matplotlib convention
  • misc changes to docstrings to improve clarity on how input data should look
  • (Edit:) Added option that makes symbols use the same color when doing 1D-plots

Possible improvements (not planned on including in this PR)

  • All QtPlot **kwargs options are now added on a where needed basis, the proper way to do this would be to use the traces['config'] as the DRY place for these settings.

What is not in this pull request (but is still related)

  • Allow add() to specify to add to a row or column
  • Make multiple heatmaps that are plotted on the same subplot share the same colormap scale (and histogram object)
  • Line-cut widget for heatmaps along x or y axis (I think this would be a really cool addition)
  • tests for plotting (how do you test for graphical bugs, if someone has a good idea here please let me know).
  • redirecting colormaps to matplotlib colormaps if a cmap does not appear in our list of predefined colormaps

If this pull request is merged #23 can be closed.

kwargs['pen'] = self.rpg.mkPen(color, width=width)
# If a marker symbol is desired use the same color as the line
if any([('symbol' in key) for key in kwargs]):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't played with symbols in pyqtgraph, but if I'm reading it right you must specify symbol in order to get symbols at all - is that right? And if so, why not just if 'symbol' in kwargs?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My tests indicate that if I specify one symbol property (such as symbolSize) it adds the symbols automatically with the default symbol.

Checking if any of these keywords occurs allows for the same behaviour as pyqtgraph while still overwriting the color of the symbol with our custom color cycle.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@alexcjohnson
Copy link
Contributor

oookay, sorry about mucking up the commit history here, I'm still not sure why it 1) merged master in, and 2) decided to show all the commits it merged in (with their associated changed files) rather than just the one merge commit.

I also don't know why I can't seem to get symbols to show up at all in pyqtgraph on my computer... it keeps failing on a hilarious traceback that ends:

    |    File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pyqtgraph/graphicsItems/ScatterPlotItem.py", line 764, in paint
    |      p.drawPixmapFragments(data['targetRect'].tolist(), data['sourceRect'].tolist(), atlas)
    |  TypeError: QPainter.drawPixmapFragments(list-of-QPainter.PixmapFragment, QPixmap, QPainter.PixmapFragmentHints hints=0): argument 2 has unexpected type 'list'

(well yes, if you say .tolist() I bet you'll get a list... what did it expect?)

despite this I think the changes are correct, can you check them out?

@AdriaanRol
Copy link
Contributor Author

I just tested them, I get the following result for a simple 1D plot (all is working)

image

This is different from what I had before
image

My initial goal was to get rid of the markeredge completely but I think that this final result is even better 👍

Also thanks for fixing the 🐄

@alexcjohnson
Copy link
Contributor

good. Still not sure what's wrong with my pyqtgraph installation but if it works for you, 💃 !

AdriaanRol added a commit that referenced this pull request Feb 11, 2016
Minor pyqtgraph plotting improvements
@AdriaanRol AdriaanRol merged commit 6fa554e into master Feb 11, 2016
@AdriaanRol AdriaanRol deleted the plotting branch February 11, 2016 08:40
jenshnielsen referenced this pull request in jenshnielsen/Qcodes Apr 10, 2017
* Fix: device annotator use left and right button to insert label and ano

* Fix: add device annotator
Fix: add tooltip explaining left and right click

* Fix: make device annotator label and formatter configurable

* Fix: use formatter in placeholder string

* Fix: rename loop parameter

* fix: make it possible to remove annotation/label

* Fix: mark parameters red in device annotator if sweept
jenshnielsen referenced this pull request in jenshnielsen/Qcodes May 2, 2017
* Fix: device annotator use left and right button to insert label and ano

* Fix: add device annotator
Fix: add tooltip explaining left and right click

* Fix: make device annotator label and formatter configurable

* Fix: use formatter in placeholder string

* Fix: rename loop parameter

* fix: make it possible to remove annotation/label

* Fix: mark parameters red in device annotator if sweept
jenshnielsen referenced this pull request in jenshnielsen/Qcodes Jun 1, 2017
* Fix: device annotator use left and right button to insert label and ano

* Fix: add device annotator
Fix: add tooltip explaining left and right click

* Fix: make device annotator label and formatter configurable

* Fix: use formatter in placeholder string

* Fix: rename loop parameter

* fix: make it possible to remove annotation/label

* Fix: mark parameters red in device annotator if sweept
jenshnielsen referenced this pull request in jenshnielsen/Qcodes Jun 22, 2017
* Fix: device annotator use left and right button to insert label and ano

* Fix: add device annotator
Fix: add tooltip explaining left and right click

* Fix: make device annotator label and formatter configurable

* Fix: use formatter in placeholder string

* Fix: rename loop parameter

* fix: make it possible to remove annotation/label

* Fix: mark parameters red in device annotator if sweept
jenshnielsen referenced this pull request in jenshnielsen/Qcodes Jun 27, 2017
* Fix: device annotator use left and right button to insert label and ano

* Fix: add device annotator
Fix: add tooltip explaining left and right click

* Fix: make device annotator label and formatter configurable

* Fix: use formatter in placeholder string

* Fix: rename loop parameter

* fix: make it possible to remove annotation/label

* Fix: mark parameters red in device annotator if sweept
jenshnielsen referenced this pull request in jenshnielsen/Qcodes Jul 7, 2017
* Fix: device annotator use left and right button to insert label and ano

* Fix: add device annotator
Fix: add tooltip explaining left and right click

* Fix: make device annotator label and formatter configurable

* Fix: use formatter in placeholder string

* Fix: rename loop parameter

* fix: make it possible to remove annotation/label

* Fix: mark parameters red in device annotator if sweept
jenshnielsen referenced this pull request in jenshnielsen/Qcodes Jul 18, 2017
* Fix: device annotator use left and right button to insert label and ano

* Fix: add device annotator
Fix: add tooltip explaining left and right click

* Fix: make device annotator label and formatter configurable

* Fix: use formatter in placeholder string

* Fix: rename loop parameter

* fix: make it possible to remove annotation/label

* Fix: mark parameters red in device annotator if sweept
jenshnielsen referenced this pull request in jenshnielsen/Qcodes Aug 3, 2017
* Fix: device annotator use left and right button to insert label and ano

* Fix: add device annotator
Fix: add tooltip explaining left and right click

* Fix: make device annotator label and formatter configurable

* Fix: use formatter in placeholder string

* Fix: rename loop parameter

* fix: make it possible to remove annotation/label

* Fix: mark parameters red in device annotator if sweept
jenshnielsen referenced this pull request in jenshnielsen/Qcodes Aug 3, 2017
* Fix: device annotator use left and right button to insert label and ano

* Fix: add device annotator
Fix: add tooltip explaining left and right click

* Fix: make device annotator label and formatter configurable

* Fix: use formatter in placeholder string

* Fix: rename loop parameter

* fix: make it possible to remove annotation/label

* Fix: mark parameters red in device annotator if sweept
jenshnielsen referenced this pull request in jenshnielsen/Qcodes Aug 7, 2017
* Fix: device annotator use left and right button to insert label and ano

* Fix: add device annotator
Fix: add tooltip explaining left and right click

* Fix: make device annotator label and formatter configurable

* Fix: use formatter in placeholder string

* Fix: rename loop parameter

* fix: make it possible to remove annotation/label

* Fix: mark parameters red in device annotator if sweept
jenshnielsen referenced this pull request in jenshnielsen/Qcodes Aug 9, 2017
* Fix: device annotator use left and right button to insert label and ano

* Fix: add device annotator
Fix: add tooltip explaining left and right click

* Fix: make device annotator label and formatter configurable

* Fix: use formatter in placeholder string

* Fix: rename loop parameter

* fix: make it possible to remove annotation/label

* Fix: mark parameters red in device annotator if sweept
jenshnielsen referenced this pull request in jenshnielsen/Qcodes Aug 10, 2017
* Fix: device annotator use left and right button to insert label and ano

* Fix: add device annotator
Fix: add tooltip explaining left and right click

* Fix: make device annotator label and formatter configurable

* Fix: use formatter in placeholder string

* Fix: rename loop parameter

* fix: make it possible to remove annotation/label

* Fix: mark parameters red in device annotator if sweept
jenshnielsen referenced this pull request in jenshnielsen/Qcodes Aug 16, 2017
* Fix: device annotator use left and right button to insert label and ano

* Fix: add device annotator
Fix: add tooltip explaining left and right click

* Fix: make device annotator label and formatter configurable

* Fix: use formatter in placeholder string

* Fix: rename loop parameter

* fix: make it possible to remove annotation/label

* Fix: mark parameters red in device annotator if sweept
jenshnielsen referenced this pull request in jenshnielsen/Qcodes Aug 18, 2017
* Fix: device annotator use left and right button to insert label and ano

* Fix: add device annotator
Fix: add tooltip explaining left and right click

* Fix: make device annotator label and formatter configurable

* Fix: use formatter in placeholder string

* Fix: rename loop parameter

* fix: make it possible to remove annotation/label

* Fix: mark parameters red in device annotator if sweept
jenshnielsen referenced this pull request in jenshnielsen/Qcodes Aug 22, 2017
* Fix: device annotator use left and right button to insert label and ano

* Fix: add device annotator
Fix: add tooltip explaining left and right click

* Fix: make device annotator label and formatter configurable

* Fix: use formatter in placeholder string

* Fix: rename loop parameter

* fix: make it possible to remove annotation/label

* Fix: mark parameters red in device annotator if sweept
jenshnielsen referenced this pull request in jenshnielsen/Qcodes Sep 21, 2017
* Fix: device annotator use left and right button to insert label and ano

* Fix: add device annotator
Fix: add tooltip explaining left and right click

* Fix: make device annotator label and formatter configurable

* Fix: use formatter in placeholder string

* Fix: rename loop parameter

* fix: make it possible to remove annotation/label

* Fix: mark parameters red in device annotator if sweept
nataliejpg pushed a commit to nataliejpg/Qcodes that referenced this pull request Oct 11, 2017
* Fix: device annotator use left and right button to insert label and ano

* Fix: add device annotator
Fix: add tooltip explaining left and right click

* Fix: make device annotator label and formatter configurable

* Fix: use formatter in placeholder string

* Fix: rename loop parameter

* fix: make it possible to remove annotation/label

* Fix: mark parameters red in device annotator if sweept
jenshnielsen referenced this pull request in jenshnielsen/Qcodes Oct 27, 2017
* Fix: device annotator use left and right button to insert label and ano

* Fix: add device annotator
Fix: add tooltip explaining left and right click

* Fix: make device annotator label and formatter configurable

* Fix: use formatter in placeholder string

* Fix: rename loop parameter

* fix: make it possible to remove annotation/label

* Fix: mark parameters red in device annotator if sweept
jenshnielsen referenced this pull request in jenshnielsen/Qcodes Nov 21, 2017
* Fix: device annotator use left and right button to insert label and ano

* Fix: add device annotator
Fix: add tooltip explaining left and right click

* Fix: make device annotator label and formatter configurable

* Fix: use formatter in placeholder string

* Fix: rename loop parameter

* fix: make it possible to remove annotation/label

* Fix: mark parameters red in device annotator if sweept
jenshnielsen referenced this pull request in jenshnielsen/Qcodes Nov 23, 2017
* Fix: device annotator use left and right button to insert label and ano

* Fix: add device annotator
Fix: add tooltip explaining left and right click

* Fix: make device annotator label and formatter configurable

* Fix: use formatter in placeholder string

* Fix: rename loop parameter

* fix: make it possible to remove annotation/label

* Fix: mark parameters red in device annotator if sweept
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants