Comments (9)
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
.
from cheatsheets.
You're right. I think it might be nicer to add markers along the sine with marker and markevery. Can you make a PR?
from cheatsheets.
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
from cheatsheets.
from cheatsheets.
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.
from cheatsheets.
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.
from cheatsheets.
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....
from cheatsheets.
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?
from cheatsheets.
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.
from cheatsheets.
Related Issues (20)
- A better answer about "How I rotate tick labels" HOT 3
- 'right' and 'top' in plt.subplots_adjust() are not directly padding size HOT 3
- Make cheatsheet background non-transparent? HOT 6
- Replace `step` with `stairs`? HOT 1
- Clarify when to use None / np.nan to segement data HOT 2
- Update for 3.6.0 HOT 2
- In the handout for beginners, plt.subplots(2, 1) should be used. HOT 4
- Branch protection and merge rules? HOT 4
- Cartopy version HOT 3
- Brazilian Portuguese translation HOT 2
- markevery HOT 1
- Update Beginner Cheatsheet: fig.show → plt.show HOT 3
- Grey text of the Cheastsheets is hard to read when printed HOT 6
- Error from fonts.py: missing files HOT 1
- Move image diff check to standalone GH actions workflow HOT 1
- prune the number of image interpolations and replace with new material HOT 2
- Style the website HOT 3
- The cheatsheets website should include a link to the GitHub page HOT 1
- broken links on cheatsheets site HOT 1
- Cursive font is not cursive
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cheatsheets.