Giter VIP home page Giter VIP logo

Comments (9)

jklymak avatar jklymak commented on May 22, 2024 1

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.

rougier avatar rougier commented on May 22, 2024

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.

Raghibshams456 avatar Raghibshams456 commented on May 22, 2024

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.

Raghibshams456 avatar Raghibshams456 commented on May 22, 2024

mat

from cheatsheets.

timhoffm avatar timhoffm commented on May 22, 2024

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.

story645 avatar story645 commented on May 22, 2024

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.

Raghibshams456 avatar Raghibshams456 commented on May 22, 2024

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.

story645 avatar story645 commented on May 22, 2024

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.

timhoffm avatar timhoffm commented on May 22, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.