JuliaPlots / Plots.jl

Powerful convenience for Julia visualizations and data analysis
https://docs.juliaplots.org
Other
1.83k stars 354 forks source link

Add a :dot markertype #1490

Closed t37w closed 1 year ago

t37w commented 6 years ago

Just recognized standalone 'GR.jl' supports as smallest displayable unit 'dot' and much more additional types than the backend 'gr.jl' of Plots. Detailed list is in documentation of function 'setmarkertype()' in 'GR.jl'. Such a small unit is useful in case one has lots of points to plot, i.e. distribution of colors of a picture. I hope this is not a restriction but something 'not yet recognized'.

mkborregaard commented 6 years ago

The discussion has come up a few times. Why is this smarter than just using a small markersize?

t37w commented 6 years ago

I tried different markers, but not all. Just double checked with "markersize=3,marker=:cross" compared with "markersize=1,marker=:cross" using the default size of the plot window. In the first case one can see colors but the marker is too large. The latter is more or less filled with nearly black markers until the window is enlarged. But then one sees the marker too large. The advantage of using a 'dot', the smallest unit to display for scatter plots is: it has no border. It has the color defined by the attribute given via the 'color =' keyword as RGB value. Nothing else. Thus when feeding red, green, blue and a color array to scatter3d with ~3000 each, one can see a distribution of the used colors when using RGB colored dots. More points are better, but be very patient and be prepared it may die. In brief - just a spot with color signalling 'here is something'.

Cheers, Thomas

mkborregaard commented 6 years ago
x,y,z = rand(3000), rand(3000), rand(3000);
@time scatter(x,y,z, msw = 0, c = RGB.(x,y,z), ms = 3)
  0.002500 seconds (12.13 k allocations: 816.811 KiB)
skaermbillede 2018-04-19 kl 22 45 47
t37w commented 6 years ago

Hello, hmm, interesting. It works and looks good for ms=markersize=1, msw=makershapewidth=0 from a real picture when using 3000 ... 15000 entries per color. But which marker symbol is used ?

Following my assumptions why this and similar questions pop up from time to time: One looks first into the source to find which markershapes (Plots name) are available and finds it uses markertypes in backend GR. There does not exist a scatter type for the number 3. But interestingly the structure before, it the linetype, has the attribute 'dot'. In addition one finds markersize and marker and stops searching as effort and result has a good ratio. Conclusion: I want a scatter plot, no dot defined, not available, missing, file an issue. After finding msw in the plots documentation in section 'attributes/#marker in the table in section 'Series' I see its full name is 'markerstrokewidth'. In general one does not connect this with a border of a shape. Somewhere on the right there is an explanation in parenthesis. There the path to the information is too long. In general no one read until this point.

\begin{some some more deeper (side-) details} The table in the WEB is too small. One can see in several rows there is more info, but it is not accessible. In addition, I use Pale Moon, a 64 bit clone of Firefox, clicking on the button to list the menu topics of the manual on the left side of the window, it is shown. But selecting a sub-menu entry does nothing. The only chance is to use the next and previous buttons at the end of each page. This and the menus on the right work well.

Now I come back to the big advantages of a well defined, and maybe long list of marker symbols (I use this naming to avoid already meaningful word used in Plots, GR, ...). Can be explained easily in the docs. One name out this replaces 2 .. 3 current attributes. Less to type and to remember. And in case users come from other plotting tools or packages, chances are higher to mach the markers they already know. Thus they feel familiar / comfortable with the Plots package. => You won a new happy user! \begin{some some more deeper (side-) details}

Sorry for the long answer the topics I mention. This is not meant to be offensive. It is written to be constructive and helpful. Yesterday I was member of a longer discussion how much time a person may take get an impression, overview, some details. This is not measured in hours but minutes. In brief, the path to the information should not last too long. Hope this helps understanding.

Cheers, Thomas

mkborregaard commented 6 years ago

I'm not sure I understand completely. Admittedly the docs could be clearer - much of the actual documentation is found under the "examples" header. The different marker symbols are e.g. documented here: http://docs.juliaplots.org/latest/examples/gr/#marker-types

What may be causing confusion for someone coming from a different plotting system is that, e.g. in R, an empty circle (pch = 1), a filled circle (pch = 16) and a filled circle with border (pch = 21) and a small dot (pch = '.') are different plotting symbols (you even need different arguments to color them, e.g. bg for pch == 21). In Plots, they are all just :circle, with or without markerstroke and markerfill. This consistency is a big plus once you get used to it, I'd say. A dot is just a :circle without the border. So, you said that the marker border was in the way of the colors, so I just reduced the width of that to 0.

In general you can find a lot of things at the REPL. E.g. Plots.supported_markers() will give you a list with the names of all markers supported by the backend. And plotattr("msw") will tell you what that keyword does, what it's default value is and so on. No need to go and look at the code.

I see we might need to increase the size of the attribute table. That would be more visible if you'd open an issue on PlotDocs with a screenshot?

mkborregaard commented 6 years ago

Also specific suggestions on how to improve the documentation are very welcome over on PlotDocs.

t37w commented 6 years ago

Hi, yes I agree, having a large bag of markers where they may differ just because of having a border or not can be a little confusing. As I don't know the function names I grep through the source. I meant in brief: For linetypes there is "dot" defined but not for scatter markers. And that markerstroke has something to do with the border of a shape is not obvious. ':dot' as marker I have seen / used in several plot tools, therefore I think it is more or less common. Maybe other too. The remark related to the docs, I just mentioned as explanation why some questions may pop up from time to time. I saw the package PlotDocs and will address the related topics there.

Cheers, Thomas

mkborregaard commented 6 years ago

Do you want to rename this issue "Add a :dot markertype"?

t37w commented 6 years ago

Good idea, fits better. I'l try.

mkborregaard commented 6 years ago

It's a good idea, for those backends that support it natively. For the others it could just correspond to reducing the markersize and setting msw = 0.

isentropic commented 4 years ago

Yeah one reason I would like this feature is when plotting 1e6 points all at once, dot has a better performance in pyplot at least. If a backend supports this natively it would be quite performant

isentropic commented 4 years ago

perhaps to avoid confusion with path type, we could name it pixel (this has been mentioned somewhere before)

t-bltg commented 1 year ago

Most backends support the :pixel marker now.