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

Image for "Basic plots - plot" should hint at markers #16

Open
timhoffm opened this issue Jul 6, 2020 · 9 comments · May be fixed by #27
Open

Image for "Basic plots - plot" should hint at markers #16

timhoffm opened this issue Jul 6, 2020 · 9 comments · May be fixed by #27

Comments

@timhoffm
Copy link
Member

timhoffm commented Jul 6, 2020

Currently the image is just sine line, which could trick users in thinking that plot is for lines and scatter is for markers.

grafik

I propose to additionally show another set of values with markers, e.g. something like:

grafik

@rougier
Copy link
Member

rougier commented Jul 7, 2020

You're right. I think it might be nicer to add markers along the sine with marker and markevery. Can you make a PR?

@Raghibshams456
Copy link

Raghibshams456 commented Jul 7, 2020

import matplotlib.pyplot as plt
import numpy as np
np.random.seed(19680801)
x = np.arange(0,4*np.pi,0.1) # start,stop,step
y = np.sin(x)
X=[1,2,3,4,5,6]
Y=[0,6,2,4,6,9]
plt.scatter(X, Y, c='orange')
plt.plot(x, y, c= "orange")
plt.gca().invert_yaxis()
plt.show()
will this code will work

@Raghibshams456
Copy link

mat

@timhoffm timhoffm linked a pull request Jul 7, 2020 that will close this issue
@timhoffm
Copy link
Member Author

timhoffm commented Jul 7, 2020

I think it might be nicer to add markers along the sine with marker and markevery.

IMHO it's important to show independent lines and markers.

@story645
Copy link
Member

story645 commented Jul 7, 2020

Somewhere on the cheatsheet it's mentioned that plot is a better option for very specific types of scatter situations and I think it's OK to leave this as general case plot is for lines and scatter is for points.

@Raghibshams456
Copy link

Raghibshams456 commented Jul 7, 2020

Can anyone plzzz tell me my code will work or not ...as I am new to open source contribution so I am understanding things slowly....

@jklymak
Copy link
Member

jklymak commented Jul 7, 2020

as general case plot is for lines and scatter is for points.

scatter is for when you need a third dimension, either represented as marker size or color. Otherwise, you should just use plot.

@story645
Copy link
Member

story645 commented Jul 7, 2020

scatter is for when you need a third dimension, either represented as marker size or color. Otherwise, you should just use plot.

for smaller datasets the difference is negligible & so you may as well not overload a function with two semantically distinct (continuous versus discrete) use cases.

@Raghibshams456 can you be more specific? How is your code not working?

@timhoffm
Copy link
Member Author

timhoffm commented Jul 7, 2020

for smaller datasets the difference is negligible & so you may as well not overload a function with two semantically distinct

I argue the other way round: From the data semantics:

  • plot() is primarily for functional relationship y = f(x) so that there is only one y per x. Whether you draw this with single markers or lines or both is a stylistic choice.
  • scatter() is for drawing points in the (x, y) plane, and optionally adding additional information like color and size.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants