Creating a smooth phase diagram

조회 수: 22 (최근 30일)
John Fullerton
John Fullerton 2022년 3월 9일
댓글: Star Strider 2022년 3월 10일
I'm looking to create a smooth phase diagram of different states (something similar to the bottom image below). My raw data is shown on the top left.
The issue is when I try to interpolate things, to smooth out the steps in the image, I always end up with some kind of border between the states. This is shown in the top right, for example, going down the dark red column, it transistions from dark red through light red to yellow. But the transition should be directly to yellow.
The issue causing this is that I have 6 different states I want to include in the phase diagram, but they don't all happen sequencially (i.e. we can go from state 1 to 3 without going though 2).
Is there a way to create smooth distinct regions of colour like the image at the bottom? (this image is just an example and does not correspond to my data)
  댓글 수: 4
Star Strider
Star Strider 2022년 3월 10일
I have no idea what you’re doing or what the data are, however interpolating to a finer grid could be the solution. The edge colour problem is separate, and llikely could be solved by toggling the 'EdgeColor' property of whatever that plot is.
John Fullerton
John Fullerton 2022년 3월 10일
I'm sorry, I haven't explained my issue well.
I'm creating a colormap with six different pixel values to represent the different states of my system that appear when varying X and Y coordinates. But interpolation means that to get from state 1 to 6, the map has to go through every other color.
But this isn't what I want to plot. Is there a way to interpolate different regions, where any color in my map can blend into any other color without going through any other states.
Thank you for your comment, I hope this makes more sense.

댓글을 달려면 로그인하십시오.

답변 (1개)

Star Strider
Star Strider 2022년 3월 10일
Again just guessing here, since I have no idea what you¹re actually doing.
I would still interpolate to a finer grid, and then threshold the results so that instead of a continuous gradient, the plot becomes stepwise.
Also, in this instance, the contourf function could be appropriate. It is possible to define the contour levels so only specific contours are plotted. This would eliminate the continuous gradient problem, and still produce the contours on a finer grid. It is also possible to turn off the contour lines themselves if it isn’t desirable to have them shown.
.
  댓글 수: 2
John Fullerton
John Fullerton 2022년 3월 10일
Thank you for your help, I'll try contourf.
Star Strider
Star Strider 2022년 3월 10일
My pleasure!

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기

제품


릴리스

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by