Python Forum
Graphing three database in one graph Python
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Graphing three database in one graph Python
#1
Hi,

I have three different data from a source. Each one of them has 2 columns. Some of those 3 sources' first columns named the same but each one of them has different data corresponding to it in the second column.

I need to use python to plot those 3 data at one graph.

X-axis should be the combination of the first column of three data from the sources. - The data is in format of: aa001 - (up to sometimes aa400); ab001 - (up to sometimes ab400).

So, the X-axis should start with a aa001 and end with ab400. Since it would just overfill the x-axis and would make it impossible to look at it in a normal size, I want to just show aa020, aa040 ..... (using the number in the string, only show it after aa0(+20) or ab0(+20))

Y-axis should be just numbers from 0-10000 (may want to change if at least one of the data has max more than 10000.

I will add the sample graph I created using excel.

My sample data would be (Note: Data is not sorted by any column and I would prefer to sort it as stated above: aa001 ...... ab400):

Data1
Name Number
aa001 123
aa032 4211
ab400 1241
ab331 33

Data2
Name Number
aa002 1213
aa032 41
ab378 4231
ab331 63
aa163 999

Data3
Name Number
aa209 9876
ab132 5432
ab378 4124
aa031 754
aa378 44
ab344 1346
aa222 73
aa163 414
ab331 61

I searched up Matplotlib, found a sample example where it plots as I want (with dots for each x-y point) but does not apply to my question.

This is the similar code I found:
x = range(100)
y = range(100,200)
fig = plt.figure()
ax1 = fig.add_subplot(111)

ax1.scatter(x[:4], y[:4], s=10, c='b', marker="s", label='first')
ax1.scatter(x[40:],y[40:], s=10, c='r', marker="o", label='second')
plt.legend(loc='upper left');
plt.show()
Sample graph (instead of aa for X-axis-> bc; ab -> mc)

I expect to see a graph as follows, but skipping every 20 in the X-axis. (I want the first graph dotted (symbolled) as the second graph but second graph to use X-axis as the first graph, but with skipping 20 in the name

[Image: DqD3e.png] <-> I want to use X-axis like this but without each data (only by 20 difference)
[Image: 8QWu7.png] <-> I want to use symbols instead of lines like in this one

Please, let me know if I need to provide any other information or clarify/correct myself. Any help is appreciated!
Reply
#2
How can I plot the graph

Getting the data from those 3 sources

Using only first letter and last digits of the first column to put it in the X-axis as in the Excel graph above

How can I only show first column data by 20 digits difference ? aa010 aa030 aa050 ... etc
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Forcing matplotlib to NOT use scientific notation when graphing sawtooth500 4 225 Mar-25-2024, 03:00 AM
Last Post: sawtooth500
  DELETE Post using Python FaceBook Graph API BIG_PESH 0 1,423 Mar-24-2022, 08:28 PM
Last Post: BIG_PESH
  Python modules to extract data from a graph? bigmit37 5 22,191 Apr-09-2021, 02:15 PM
Last Post: TysonL
  graphing inequalities Dasiey12 0 3,424 Mar-30-2021, 01:47 AM
Last Post: Dasiey12
  Python Matplotlib: How do I plot lines with different end point in the same graph? JaneTan 0 1,550 Feb-28-2021, 11:56 AM
Last Post: JaneTan
  How to add an image to an existing facebook post using python graph API? Ascalon 0 2,180 Dec-01-2020, 08:33 PM
Last Post: Ascalon
  Python I/O: input a graph anata2047 4 2,757 Jun-19-2020, 01:02 PM
Last Post: deanhystad
  Help Graphing Arduino Data Real Time in Python nschulz 0 2,498 Mar-12-2020, 06:15 PM
Last Post: nschulz
  Matplotlib graphing help (dual y axis, groupby, filter) keml 0 2,166 Feb-07-2020, 02:35 AM
Last Post: keml
  Graphing from a while loop McDweevo 1 2,837 Nov-13-2019, 08:02 PM
Last Post: micseydel

Forum Jump:

User Panel Messages

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