Python Forum
How do you create a scatterplot of dataframe using matplotlib?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How do you create a scatterplot of dataframe using matplotlib?
#1
A very simple question.

I tried looking for how to make a scatterplot with matplotlib (as usual, the official documentation was irrelevant) and most of the examples were with manually entered x/y data which makes no sense because you would never actually do that, and the other five or so examples were all different and none of them worked. For example

#matplotlib.pyplot.scatter('BirthYear','AgeRecdSmartphone')
#studentd.scatter('BirthYear', 'AgeRecdSmartphone')

studentd.plot.scatter(x='BirthYear', y='AgeRecdSmartphone')

sort of works except that the y axis has no sort whatsoever: it goes top to bottom, 111,16,17,15,"11","10",8,9,13,10,11,12,14, therefore no pattern is visible.
Reply
#2
How do I subscribe? No button is shown.
Reply
#3
The examples show the Y axis points in order,
Unmasked: https://matplotlib.org/stable/gallery/sh...scatter-py

masked: https://matplotlib.org/stable/gallery/li...-masked-py
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Create new dataframe from old dataframe arvin 3 1,033 Jan-31-2023, 01:23 PM
Last Post: jefsummers
  Cannot convert the series to <class 'int'> when trying to create new dataframe column Mark17 3 8,732 Jan-20-2022, 05:15 PM
Last Post: deanhystad
  Matplotlib: How do I convert Dates from Excel to use in Matplotlib JaneTan 1 3,357 Mar-11-2021, 10:52 AM
Last Post: buran
  Xlsxwriter: Create Multiple Sheets Based on Dataframe's Sorted Values KMV 2 3,609 Mar-09-2021, 12:24 PM
Last Post: KMV
  Python Matplotlib: How do I save (in pdf) all the graphs I create in a loop? JaneTan 1 9,023 Feb-28-2021, 06:20 PM
Last Post: Larz60+
  Python Matplotlib: Create chart for every 4 columns in Excel file JaneTan 2 2,850 Feb-28-2021, 05:02 AM
Last Post: JaneTan
  cannot create animation on 2D array using Matplotlib and FuncAnimation Caffeine_Addict 1 2,564 Jan-12-2021, 11:35 AM
Last Post: Caffeine_Addict
  JSON Decode error when using API to create dataframe Rubstiano7 4 3,063 Jan-11-2021, 07:52 PM
Last Post: buran
  seaborn scatterplot npiatti 1 1,938 Mar-03-2020, 01:54 PM
Last Post: scidam
  Create Animated Scatter plot in 3d using matplotlib in python barry76 0 3,984 Mar-29-2019, 12:13 PM
Last Post: barry76

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020