[Tutor] Matplotlib scatterplot help
Alan Gauld
alan.gauld at yahoo.co.uk
Mon Apr 30 19:58:32 EDT 2018
On 30/04/18 16:57, Daniel Bosah wrote:
> I have a function in which returns scatterplot of a Isomap
Below you show a function that creates a scatterplot
but it does not return anything. Sorry to nitpick but correct
terminology is quite important in understanding what you
are trying to achieve.
> Below is the function to turn my Isomap values to a 3D scatterplot :
>
> def Isomap(tfidf):
> jon = pd.read_csv(tfidf)
> le = preprocessing.LabelEncoder()
> tims = jon.apply(le.fit_transform)
> iso = manifold.Isomap(n_neighbors=2, n_components=3)
> john = iso.fit_transform(tims)
> fig = plt.figure()
> ax = fig.add_subplot(111, projection='3d')
> use_colors = 'rybg'
> ax.scatter(john[:,0], john[:,1],john[:,2],color=use_colors,alpha=.5) #
> x,y,z coord. jon 1-3
> plt.title('Isomap of candiates')
> plt.xlabel('x')
> plt.ylabel('y')
> plt.show()
> plt.savefig('isomap.png')
>
> The problem is that I usually only get one color returned.
Do you mean displayed? Nothing is returned (or to be
pedantic, None is returned)
> get the code to print out 4 colors,
Again nothing is printed. Are you talking about the
displayed scatterplot?
> I'm not sure how to get those colors
> to correspond to the four web articles.
Sadly neither do I, you need a mmatplotlib user
to answer that bit. The only reference to
colors I can see is the line
use_colors - 'rybg'
Which I assume stands for red, yellow, blue,green?
I further assume that the order is significant?
But I'm only guessing...
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos
More information about the Tutor
mailing list