Recent

Author Topic: Question about ColorMap chart  (Read 6990 times)

madepabloh

  • Full Member
  • ***
  • Posts: 160
Question about ColorMap chart
« on: September 29, 2012, 12:54:43 pm »
This is only a question about the ColorMapSeries type of plot in TAChart component.

I saw the example (Demo/func), and also readed the documentation in the wiki, but i do not have clear if this type of plot allow this kind of plots:
https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcQ-adEBMiQu1pkx7RbeLq-B5f2L1_lNww0kGFmpctpmW0CyR-e87A

I mean, i want to represent a 2D map of a 3D data (XYZ). Interpolations and contour lines could be great, but for the moment i just want the basic. Then, is it colormap the way to produce this type of maps?

Thanks!
« Last Edit: September 29, 2012, 01:10:00 pm by madepabloh »

Ask

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 687
Re: Question about ColorMap chart
« Reply #1 on: September 29, 2012, 01:38:20 pm »
Quote
is it colormap the way to produce this type of maps?
Yes.

madepabloh

  • Full Member
  • ***
  • Posts: 160
Re: Question about ColorMap chart
« Reply #2 on: September 30, 2012, 02:37:03 pm »
Thanks @Ask,

I am now fighting with this type of plot. I explored the demo (demo/func) where the use of this plot is showed. However, i still do not have clear how it works. Okay, in really, i didn´t discover how to show my data in this plot.

I have some more questions:

I saw this type of chart plot the calculated values from a function what depends of X and Y. However, i do not have a function, but (X,Y,Z) values in a file. So, is it not possible to plot them?

On the other hand, in the ListChartSource,  i can select the color for the data points (X,Y), but i would like to represent the colors depending of the Z value, so, is it not able to do it?

Also related to the scale, i saw one by one color must be assigned to each X,Y pair. Is it not able to graduate between two colors assigned to the extreme values?

I saw there is an interpolation option. What kind of interpolation? It is able to implement others?

But one by one step, i would like to know how could i plot (X,Y,Z) values into this type of chart, when the z data does not depends of a function of (X,Y).

Thanks!

@Ask, you probably implemented this type of chart due to my request a couple of years ago. I never went back to this topic but i am involved again in it. So, thanks for your efforts to include and develop this type of plot!

Ask

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 687
Re: Question about ColorMap chart
« Reply #3 on: September 30, 2012, 04:14:27 pm »
Quote
i do not have a function, but (X,Y,Z) values in a file. So, is it not possible to plot them?
Yes, but you will have to perform interpolation yourself. This is quite a wide field -- from nearest neighbor to kriging.

Quote
in the ListChartSource,  i can select the color for the data points (X,Y), but i would like to represent the colors depending of the Z value
If your points are reasonably dense, you can create a "cloud chart" by drawing a scatter plot and assigning each point a color based on Z value.
But I do not think it is what you want.

Quote
Also related to the scale, i saw one by one color must be assigned to each X,Y pair. Is it not able to graduate between two colors assigned to the extreme values?
I saw there is an interpolation option. What kind of interpolation?
As you can see in the documentation, Interpolate option performs interpolation in color space.

Quote
It is able to implement others?
That depends on what you mean by "it" :-)
If you mean me, then yes, I can consider implementing some spatial interpolation algorithms. However, it is a large task, and on the edge of possible TAChart scope, so I would prefer to use some existing library for that. Do you know any suitable Pascal library?

Quote
how could i plot (X,Y,Z) values into this type of chart, when the z data does not depends of a function of (X,Y).
I think you have used incorrect terminology, but if your Z is really not a function of X and Y, then you have an arbitrary set of 3-d points. You can not simply plot such data on a 2-d surface -- some kind of projection is required.

You can also look at this discussion of similar problem.

madepabloh

  • Full Member
  • ***
  • Posts: 160
Re: Question about ColorMap chart
« Reply #4 on: September 30, 2012, 06:30:23 pm »
Thanks @Ask for your detailed reply,

I see what are the problems. Thanks for clarify them.

I don´t know any library, but I will use google to see if there is a library around interpolation methods and algorithms what could be used here.

Quote
I think you have used incorrect terminology, but if your Z is really not a function of X and Y, then you have an arbitrary set of 3-d points. You can not simply plot such data on a 2-d surface -- some kind of projection is required.
You are true. However, in my case, i am working with an small square grid (100x100 m), with nodes every 10 meters. I measure different stuffs in each node, and my idea is to plot a map of each one parameter. So, since the area is pretty small, not proyection is required.

Quote
If your points are reasonably dense, you can create a "cloud chart" by drawing a scatter plot and assigning each point a color based on Z value.
You are rigth, this is not what i am looking for, but it is an interesting idea. I will test it just to see if it could be used such as a preview of the raw data, previous to any interporlation calculation.

I will inform if i locate a library or algorithms ready to apply in Pascal languaje.

Thanks Ask!

Ask

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 687
Re: Question about ColorMap chart
« Reply #5 on: September 30, 2012, 07:05:20 pm »
Quote
i am working with an small square grid (100x100 m), with nodes every 10 meters.
Ah, so your data is regular. You should have said so.
Look at the link I gave in the previous post -- it contains a ready solution for your problem.

madepabloh

  • Full Member
  • ***
  • Posts: 160
Re: Question about ColorMap chart
« Reply #6 on: September 30, 2012, 08:47:43 pm »
Yes, they are. Sorry for not to say from the beganing.

I downloaded the example and your improvement from the link you provided. I will study it to learn how it works. Thanks!

BTW, i already made a plot shoing only the points. I will explore how to change their color depending of z value.

madepabloh

  • Full Member
  • ***
  • Posts: 160
Re: Question about ColorMap chart
« Reply #7 on: October 20, 2012, 02:02:16 pm »
About one month later, i am still not able to understand how to figure out the problem of how to show a colormap based on x,y,z data (i attach one example file).

I am able to charge the data into a stringgrid, but i don´t know how to plot a color map with them. List source component of TAChart only allow to changer x,y, but not Z values... Moreover, in my case Z values are not a function of X,Y... so, oncalculate event i am not able to write a formula...

Could you help me with this? Thanks in advance!

wp

  • Hero Member
  • *****
  • Posts: 11830
Re: Question about ColorMap chart
« Reply #8 on: October 20, 2012, 03:01:38 pm »
I don't know of a finished freely available procedure/component for 2d interpolation, so I fear you'll have to write one by yourself. Your data look as if you have regularly spaced vertices, that makes life much easier. Have a look at the wikipedia article on 2d interpolations, e.g. http://en.wikipedia.org/wiki/Bilinear_interpolation and the references therein - it is not that difficult. But linear interpolation does not look very nice, maybe you should look for spline interpolation.

So, in the end you will have a function that you can use to interpolate the z value for any point in the (x,y) plane, and this is the function you have to use in the OnCalculate event. Maybe the calculation will be too slow, then you'll have to buffer the results in a dynamically allocated 2d-array.

If you have basic problems with the ColorMapSeries maybe my tutorial in http://wiki.lazarus.freepascal.org/TAChart_Tutorial:_ColorMapSeries,_Zooming can help you, but you should be aware that it is not yet finished.
« Last Edit: October 20, 2012, 03:45:59 pm by wp »

 

TinyPortal © 2005-2018