Matplotlib exporter scientific notation bugfix#1051
Matplotlib exporter scientific notation bugfix#1051penkod wants to merge 2 commits intopyqtgraph:developfrom
Conversation
…plots which use scientific notation.
ixjlyons
left a comment
There was a problem hiding this comment.
I think I would prefer fixing the labels to actually scaling the data. I kind of alluded to that in #1050 , but I suppose this works and requires fewer code changes. The only issue I see is that no information about the scale of the data is not provided to matplotlib, aside from the axis label. I'm inclined to accept this PR though if you don't mind working on the specific things I commented on.
| for item in self.item.curves: | ||
| x, y = item.getData() | ||
|
|
||
| # pyqtgraph by default uses scientific notation for large |
There was a problem hiding this comment.
Just one copy of the comment at the top should be sufficient.
|
|
||
| # pyqtgraph by default uses scientific notation for large | ||
| # values. Matplotlib values and label should reflect that too. | ||
| SIprefix_scale_default = 1.0 # default SI prefix scale value |
There was a problem hiding this comment.
I think a more straightforward implementation might loo something like:
scale_x = scale_y = 1.0
if self.items.axes['bottom']['item'].autoSIPrefix: # note no need for == True here
scale_x = self.item.axes['bottom']['item'].autoSIPrefixScale
if self.items.axes['left']['item'].autoSIPrefix:
scale_y = self.item.axes['left']['item'].autoSIPrefixScaleThen simply apply scale_x/scale_y below without the conditionals.
|
Hey @penkod, I can go ahead and build from your commits to implement the requested changes. If you prefer to do it yourself, let me know. Thanks for the contribution in any case. |
|
Hi @ixjlyons. At the time being, I unable to do the necessary changes + the tests, so of course, if you wish you can implement the necessary changes yourself. |
Fix setting labels and values in case of plots which use scientific notation.
Solves issue #1050