visualdatatools.com Forum Index visualdatatools.com
Discussion for DataTank and DataGraph
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

contour plot labels

 
Post new topic   Reply to topic    visualdatatools.com Forum Index -> Feature Request
View previous topic :: View next topic  
Author Message
dehose



Joined: 06 Feb 2007
Posts: 32

PostPosted: Thu Jan 05, 2017 8:35 am    Post subject: contour plot labels Reply with quote

Hej,

I made a scalar field plot and also showed the contour lines.

Can you somehow implement a function to show the contour labels like it's possible in Matlab? https://se.mathworks.com/help/matlab/ref/clabel.html

thank you Very Happy
Back to top
View user's profile Send private message
dehose



Joined: 06 Feb 2007
Posts: 32

PostPosted: Wed Mar 01, 2017 10:32 am    Post subject: Reply with quote

did you have to think about this request? Smile
Back to top
View user's profile Send private message
David
Site Admin


Joined: 25 Nov 2006
Posts: 1954
Location: Chapel Hill, NC

PostPosted: Fri Mar 03, 2017 6:36 pm    Post subject: Reply with quote

I will look into this. Can you send me a sample file? I have code for this in DataTank, but I'm not completely happy with how I deal with contours in the scalar field in DataGraph. Having a realistic use case would be very helpful.

So if you can send me an example of what type of data you have I will use it to refine the DataGraph implementation.

David
Back to top
View user's profile Send private message Send e-mail
pjuk



Joined: 01 Jun 2017
Posts: 22
Location: London, UK

PostPosted: Mon Jun 05, 2017 12:19 pm    Post subject: Reply with quote

Hi David,

I'm sort of hijacking the feature request forum but would love to see this option with the scalar plot. I'm currently generating magnetic field plots and use R and the filled.contour & contour commands to generate contour plots with labels which works nicely as well as produce a good legend.

I've attached what I can currently output and wondered if this real world example would help.

Thanks!

[edit] would it also possible to use the label command to output the value, not just the x/y coordinate?

R output


Datagraph (looking good)

bbcode image
Back to top
View user's profile Send private message
David
Site Admin


Joined: 25 Nov 2006
Posts: 1954
Location: Chapel Hill, NC

PostPosted: Mon Jun 05, 2017 1:09 pm    Post subject: Reply with quote

This will be a very good use case.

I'm also working on data exporters, I have a package on CRAN to export data frames and vectors, and I'm interested in extending that to scalar fields as well. In fact the beta supports the import, I haven't added that to the R API. How do you describe the scalar field in R?

David
Back to top
View user's profile Send private message Send e-mail
pjuk



Joined: 01 Jun 2017
Posts: 22
Location: London, UK

PostPosted: Tue Jun 06, 2017 6:07 am    Post subject: Reply with quote

I specify an 4D matrix (x y z with B(x,y,z,mod(B)) and populate the elements according to my calculations. I then also have three vectors that then correspond to the coordinates along x y z.

I can then dump the appropriate "plane" into three vectors, say x and y and the associated B field into a CSV file and drag/drop into DataGraph.

Possibly crude, I'm not sure, but I'm comfortable programming in R.

Here is the structure of my output...



What is the name of your package? I had to write my own script to deal with exporting different length vectors, data frames etc... as I'll have R deal with data analysis (I can't stand excel) and then create ironically .xlsx files to share with colleagues.
Back to top
View user's profile Send private message
David
Site Admin


Joined: 25 Nov 2006
Posts: 1954
Location: Chapel Hill, NC

PostPosted: Tue Jun 06, 2017 8:35 am    Post subject: Reply with quote

The package is called DataGraph

Here is a page about it (rough at the moment)
https://www.visualdatatools.com/DataGraph/Help/DataFile/R/

This is just in the beta version, and I'm working on fleshing out the functionality.

You could flatten out the coordinates, put them into a data frame and use the DataGraph package to save it to a DataGraph binary file. But what I want to make possible in R is to save the two dimensional array of numbers directly. The file format defines a two dimensional scalar field object.

Because it is hard to attach files to the discussion board I think the best thing is to move the discussion to e-mail - david@visual... Anyone else that is interested is welcome to do the same.

I want to do something like

addDTBinScalarField(filename,name in DataGraph,array variable,x grid, y grid)

What I don't know is if you attach the locations as properties, layout etc.


David
Back to top
View user's profile Send private message Send e-mail
pjuk



Joined: 01 Jun 2017
Posts: 22
Location: London, UK

PostPosted: Tue Jun 06, 2017 10:43 am    Post subject: Reply with quote

I currently flatten the coordinates to export to DataGraph using write.csv() command in R. I could equally do this in the calculation but the reason the data is in an matrix format is for internal plotting in R. Did you have any reason for wanting a 2D array in DataGraph? I can imagine it would be a bit awkward to navigate a say anything > 100x100 matrix.

I'll check out your R package in the meantime.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    visualdatatools.com Forum Index -> Feature Request All times are GMT - 3 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group