-
Notifications
You must be signed in to change notification settings - Fork 783
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
support "lineStyle" arguments #59
Comments
It would be great to be able to plot dotted, dashed, and other patterns of lines. I think the only plottable objects which would benefit from this are scatter plots and axis lines. This should be easy to implement too. Lines are drawn with
Once implemented, the legend code could be updated to draw proper dash styles too. The website |
I’ll give it a try.
Would you please in the meantime inspect the possibility to make Plottable class serializable?
I’m having a hard time at time at that.
|
Looks difficult to combine the mark symbol with the line type, though. Do we need to put the line type aside the mark symbol and enlarge the legend frame?
|
The legend could just show line (with its DashStyle) and place a single marker above it (if markers are being used). # python example
import matplotlib.pyplot as plt
import numpy as np
xs = np.arange(20)
ys = np.sin(np.pi*2*xs/len(xs))
plt.plot(xs, ys, label='data', linestyle=':',
marker='v', markerfacecolor='r', markeredgewidth=0)
plt.legend()
plt.show() |
Ok, but I think we have to face a minor drawback. The dash spacing is exactly as wide as line thickness, therefore it looks like this. I think we need to redefine the styles. What do you think.
|
... actually, maybe all our patterns should be custom? Maybe the dash values are some multiple of line width? |
Yes, all of them need to be custom, to properly render. I’m working on it. Will commit later tonight.
|
Sounds great! Thanks for your contribution! It's looking great already. |
Another thing I noticed about Legends, sometimes it could be useful to change their size / font type. As for example, we have in the case of the PlotText() method. |
A review of fonts for the title, axis labels, legend, and PlotText() is a good idea! Some of these features are implemented and some aren't, but a review of each of these methods to fill-in the missing features and ensure consistency would be an improvement for sure. I started an issue devoted to this topic #61 Regarding the marker size in the legend, I think it should reflect the marker size in the plot itself. Scatter plots could code plot groups by marker size, so since that may be its own metric let's stick to drawing it "actual size" in the legend. |
This also makes me think we should probably should draw the lines in the legend as their actual size, since lineWidth might be used to separate groups of data... @Padanian do you want to make this change? |
It can end up in a disproportioned marker in the legend.
|
It'll be awful. Been there, done that.
That's why I set it to fixed linewidth.
|
I agree the marker symbol should be proportioned to the font size, but
not to the marker size.When font size selection would be available, a
small correction to the legend code might be necessary.If you like the
marker symbol to be bigger as it is, we could scale it up a little
bit.
|
Marker size to reflect legend font size is ready to request pull, but you already got a pull request ahead. Please pull it before this or delete it. |
Just pulled @Padanian's branch into the master (#60). I called the argument "lineStyle" to be consistent with matplotlib's naming convention. I also added an example to the cookbook: https://github.com/swharden/ScottPlot/tree/master/cookbook#custom-linestyles Thanks @Padanian! |
Hi, I used this: |
You already implemented selectable marker shapes for Plots, which is great! What do you think, could it be possible to also implement dashed line types (like dotted, dash, dash/dots, etc)?
In this case, I think the legend section could automatically show marker shapes / line types, depending on the following conditions:
I will really try to find some time later on to do some real contribution to the code base, sorry that recently I can only provide such limited help...
The text was updated successfully, but these errors were encountered: