Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scatter plot labels #716

Closed
mcenerney1 opened this issue Sep 26, 2014 · 19 comments
Closed

Scatter plot labels #716

mcenerney1 opened this issue Sep 26, 2014 · 19 comments
Labels
Milestone

Comments

@mcenerney1
Copy link
Contributor

When trying to put labels on a scatter plot with
presentation.xticlabels1 = {1:'20', 2: 'abc'}
presentation.yticlabels1 = {1:'40', 2: 'def'}
What happens is the xtics and ytics are trashed(blank).

@williams13
Copy link
Contributor

I have found that this also is the case for 1D plots as well. The VTK is not plotting annotations properly if at all.

From: James McEnerney <notifications@github.commailto:notifications@github.com>
Reply-To: UV-CDAT/uvcdat <reply@reply.github.commailto:reply@reply.github.com>
Date: Friday, September 26, 2014 4:03 PM
To: UV-CDAT/uvcdat <uvcdat@noreply.github.commailto:uvcdat@noreply.github.com>
Subject: [uvcdat] Scatter plot labels (#716)

When trying to put labels on a scatter plot with
presentation.xticlabels1 = {1:'20', 2: 'abc'}
presentation.yticlabels1 = {1:'40', 2: 'def'}
What happens is the xtics and ytics are trashed(blank).


Reply to this email directly or view it on GitHubhttps://github.com//issues/716.

@aashish24
Copy link
Contributor

@williams13 I think its is a bug in the vcs-vtk code and not in vtk. I have drawn annoations before without any issue. We will have a look.

@williams13
Copy link
Contributor

Thanks! The clear and close is a bigger issue for the diagnostics and the animation.

From: Aashish Chaudhary <notifications@github.commailto:notifications@github.com>
Reply-To: UV-CDAT/uvcdat <reply@reply.github.commailto:reply@reply.github.com>
Date: Saturday, September 27, 2014 2:13 PM
To: UV-CDAT/uvcdat <uvcdat@noreply.github.commailto:uvcdat@noreply.github.com>
Cc: Dean Williams <williams13@llnl.govmailto:williams13@llnl.gov>
Subject: Re: [uvcdat] Scatter plot labels (#716)

@williams13https://github.com/williams13 I think its is a bug in the vcs-vtk code and not in vtk. I have drawn annoations before without any issue. We will have a look.


Reply to this email directly or view it on GitHubhttps://github.com//issues/716#issuecomment-57065960.

@aashish24 aashish24 added this to the 2.1 milestone Sep 29, 2014
@aashish24
Copy link
Contributor

Sure.for now marked it for 2.1

@doutriaux1 doutriaux1 added the VCS label Oct 3, 2014
@doutriaux1
Copy link
Contributor

@mcenerney1 quick question, are "1"/"2" valid values for your range in x/y? remember these are "values" not "indices"

@doutriaux1
Copy link
Contributor

works for me
scatter

@doutriaux1
Copy link
Contributor

oops and the code to go with it:

import vcs,cdms2,sys,os
f=cdms2.open(os.path.join(sys.prefix,"sample_data","clt.nc"))
u=f("u")
v=f("v")

x=vcs.init()
sc=x.createscatter()
sc.markersize=5
sc.xticlabels1={1:"ONE",2:"TWO"}
sc.yticlabels1={1:"ONE",2:"TWO"}
x.plot(u,v,sc)

@mcenerney1
Copy link
Contributor Author

The axis tics and range are overwritten.

From: Charles <notifications@github.commailto:notifications@github.com>
Reply-To: UV-CDAT/uvcdat <reply@reply.github.commailto:reply@reply.github.com>
Date: Friday, October 3, 2014 11:19 AM
To: UV-CDAT/uvcdat <uvcdat@noreply.github.commailto:uvcdat@noreply.github.com>
Cc: James McEnerney <mcenerney1@llnl.govmailto:mcenerney1@llnl.gov>
Subject: Re: [uvcdat] Scatter plot labels (#716)

oops and the code to go with it:

import vcs,cdms2,sys,os
f=cdms2.open(os.path.join(sys.prefix,"sample_data","clt.nc"))
u=f("u")
v=f("v")

x=vcs.init()
sc=x.createscatter()
sc.markersize=5
sc.xticlabels1={1:"ONE",2:"TWO"}
sc.yticlabels1={1:"ONE",2:"TWO"}
x.plot(u,v,sc)


Reply to this email directly or view it on GitHubhttps://github.com//issues/716#issuecomment-57833772.

@williams13
Copy link
Contributor

For all plots, I couldn't get the xmintic and ymintic to work, but didn't want to bring this up yet. I couldn't get the axis labels to plot either. I will need these before the mintics.

From: James McEnerney <notifications@github.commailto:notifications@github.com>
Reply-To: UV-CDAT/uvcdat <reply@reply.github.commailto:reply@reply.github.com>
Date: Friday, October 3, 2014 11:22 AM
To: UV-CDAT/uvcdat <uvcdat@noreply.github.commailto:uvcdat@noreply.github.com>
Cc: Dean Williams <williams13@llnl.govmailto:williams13@llnl.gov>
Subject: Re: [uvcdat] Scatter plot labels (#716)

The axis tics and range are overwritten.

From: Charles <notifications@github.commailto:notifications@github.commailto:notifications@github.com>
Reply-To: UV-CDAT/uvcdat <reply@reply.github.commailto:reply@reply.github.commailto:reply@reply.github.com>
Date: Friday, October 3, 2014 11:19 AM
To: UV-CDAT/uvcdat <uvcdat@noreply.github.commailto:uvcdat@noreply.github.commailto:uvcdat@noreply.github.com>
Cc: James McEnerney <mcenerney1@llnl.govmailto:mcenerney1@llnl.govmailto:mcenerney1@llnl.gov>
Subject: Re: [uvcdat] Scatter plot labels (#716)

oops and the code to go with it:

import vcs,cdms2,sys,os
f=cdms2.open(os.path.join(sys.prefix,"sample_data","clt.nc"))
u=f("u")
v=f("v")

x=vcs.init()
sc=x.createscatter()
sc.markersize=5
sc.xticlabels1={1:"ONE",2:"TWO"}
sc.yticlabels1={1:"ONE",2:"TWO"}
x.plot(u,v,sc)


Reply to this email directly or view it on GitHubhttps://github.com//issues/716#issuecomment-57833772.


Reply to this email directly or view it on GitHubhttps://github.com//issues/716#issuecomment-57834162.

@doutriaux1
Copy link
Contributor

we'll have to look into this because as showed on the pix above it seems to be working. can you provide an example? @mcenerney1 do a presentation.list() and send me the output, also please save the data being plotted to a netcdf file and send me this ok? thx

@mcenerney1
Copy link
Contributor Author

The example above shows the issue, doesn't it?

@doutriaux1
Copy link
Contributor

no it doesn't i tell it to draw labels "ONE" and "TWO" instead of 1,2 and nothing else, so it does exactly what is expected.

@mcenerney1
Copy link
Contributor Author

How do you get the range on the axes?

@doutriaux1
Copy link
Contributor

data.getAxis(-1)[:].min()

@mcenerney1
Copy link
Contributor Author

.. and displayed on the graph.

@doutriaux1
Copy link
Contributor

presentation.datawc_x1=min
presentation.xticlabels1= some_dictionary

where some_dict is a dictionary containing ALL the values you want displayed with their corresponding string

one way to generate this dictionary is to use:

In [4]: min =0

In [5]: max = 10

In [6]: vcs.mklabels(vcs.mkscale(min,max))
Out[6]: 
{0.0: '0',
 1.0: '1',
 2.0: '2',
 3.0: '3',
 4.0: '4',
 5.0: '5',
 6.0: '6',
 7.0: '7',
 8.0: '8',
 9.0: '9',
 10.0: '10'}

@williams13
Copy link
Contributor

Jim, if you do a:

presentation.list()

you will see the object's attributes and settings, like the template.

From: Charles <notifications@github.commailto:notifications@github.com>
Reply-To: UV-CDAT/uvcdat <reply@reply.github.commailto:reply@reply.github.com>
Date: Friday, October 3, 2014 2:50 PM
To: UV-CDAT/uvcdat <uvcdat@noreply.github.commailto:uvcdat@noreply.github.com>
Cc: Dean Williams <williams13@llnl.govmailto:williams13@llnl.gov>
Subject: Re: [uvcdat] Scatter plot labels (#716)

presentation.datawc_x1=min
presentation.xticlabels1= some_dictionary

where some_dict is a dictionary containing ALL the values you want displayed with their corresponding string

one way to generate this dictionary is to use:

In [4]: min =0

In [5]: max = 10

In [6]: vcs.mklabels(vcs.mkscale(min,max))
Out[6]:
{0.0: '0',
1.0: '1',
2.0: '2',
3.0: '3',
4.0: '4',
5.0: '5',
6.0: '6',
7.0: '7',
8.0: '8',
9.0: '9',
10.0: '10'}


Reply to this email directly or view it on GitHubhttps://github.com//issues/716#issuecomment-57867754.

@mcenerney1
Copy link
Contributor Author

I've been mistaken that displaying labels would preserve the axes. I'll give it a try.

@doutriaux1
Copy link
Contributor

i think it was a @mcenerney1 user error. Closing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants