0

I build a scatter plot using matplotlib and python2.7 Here is the code:

def parse_dataset(dataset):
     foo   = dataset[0]
     bar = dataset[3]
     baz  = dataset[4]
     fig=plt.figure()
     plt.xlabel('foo')
     plt.ylabel('bar')
     plt.title("foo--bar--baz")
     plt.scatter(foo,bar,color = 'r')
     #plt.savefig("test.png", bbox_inches='tight', pad_inches=0.5,dpi=100)
     plt.show()
    # plt.clf()

However, what I would like to do is the following: Build a scatter plot for baz based on the x-axis(foo) and y-axis(bar) that is, based on the x-axis and y-axis. i want the value of baz to be plotted as text next to the point.

Scatter plot on the one hand, only allows me to have two dimensions to be given. I tried the ax.plot(x,y,z) which allows me to plot in three dimensions (which however doesn't serve my purpose).

Is there a way to plot baz based on the values on foo and bar

Example of data:

Foo Bar baz
1   2   3
4   5   6
7   8   9
10  11  12

For every foo and bar i want the value of baz to be plotted.

It is a normal scatter plot.

pseudocubic
  • 1,039
  • 1
  • 14
  • 20
pistal
  • 2,310
  • 13
  • 41
  • 65

0 Answers0