Saying I have a time series of temperature, could I manage to turn the simple black line indicating the change of temperature to a colourful line transiting from blue (cooler) to red (warmer)?2 months, 1 week ago kirktParticipant
Excellent question. I also would love to hear the answer, but with the slight variation of changing the line color by its Y value, so as to indicate the Y value’s crossing a threshold value (think something like the line is green until it gets above a certain threshold Y value, then it turns yellow, and when it crosses an even higher Y threshold value it turns red).
I have done this before by using masks and plotting the same data multiple times with the above colors and making a single composite line, but being able to do it with one plot command would be cool.
2 months, 1 week ago dgteamModerator
- This reply was modified 2 months, 1 week ago by kirkt.
The way to do this is to use a different command – the Connect command.
There is an example file that I would recommend reviewing called “Line segments with color scheme”.
The basic approach is that you use an expression to create a second x snd y column that are the values at the next row. Then the connect command draws the line segments for each row. You can use any column in the table to base a color scheme.
Please try it out and let us know if this works for you or if you have any other questions.
Thank dgteam. The solution partially solve the issue. The problem is when the line connecting two points is descending or ascending, the colour won’t change with value, which is defined by the starting or ending point. Therefore, errors occur when the same values have different colours. I attached a shot here.2 months, 1 week ago dgteamModerator
What you can do is use the Plot action column to first interpolate your data to get a denser set of points on the x axis.
Here is an example to illustrate. The first two data columns are the original data.
The Date column in the group is generated using an expression to list each day. the Value uses this Date as the Locations to interpolate (Plot action column). The x and y input columns outlined in blue are the original discrete data that we are interpolating.
That gives a value for each day and when this is used in the Connect command (using the approach outlined in the example file mentioned in the last post), a smooth representation of the value is shown using the color ramp.
Here we used the linear interpolate method (bottom of the Plot action column). You could also choose a cubic or spline, depending on what makes the most sense for your data.
Does this help?
Yes, this solved this issue completely. Thanks.
You must be logged in to reply to this topic.