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

Add a :dot markertype #1490

Closed
t37w opened this issue Apr 18, 2018 · 13 comments
Closed

Add a :dot markertype #1490

t37w opened this issue Apr 18, 2018 · 13 comments
Labels
enhancement improving existing functionality

Comments

@t37w
Copy link

t37w commented Apr 18, 2018

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
Copy link
Member

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

@t37w
Copy link
Author

t37w commented Apr 19, 2018

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
Copy link
Member

mkborregaard commented Apr 19, 2018

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
Copy link
Author

t37w commented Apr 20, 2018

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
Copy link
Member

mkborregaard commented Apr 21, 2018

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
Copy link
Member

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

@t37w
Copy link
Author

t37w commented Apr 21, 2018

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
Copy link
Member

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

@t37w
Copy link
Author

t37w commented Apr 21, 2018

Good idea, fits better. I'l try.

@t37w t37w changed the title Backend gr.jl supports less markertypes than standalone GR.jl Add a :dot markertype Apr 21, 2018
@mkborregaard mkborregaard added the enhancement improving existing functionality label Apr 21, 2018
@mkborregaard
Copy link
Member

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
Copy link
Member

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
Copy link
Member

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

@t-bltg
Copy link
Member

t-bltg commented Nov 24, 2022

Most backends support the :pixel marker now.

@t-bltg t-bltg closed this as completed Nov 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement improving existing functionality
Projects
None yet
Development

No branches or pull requests

4 participants