Superposition of contour and contourf

조회 수: 4 (최근 30일)
samen
samen 2011년 10월 21일
답변: Rémi BERTRAND 2018년 10월 16일
Hello,
I have two matrices of same dimensions. One can only contain three types of numbers (either 1 or 2 or 3). This matrix serves me to draw the boundaries of my system with the function contour (X, Y, domains). I use a personal colorbar with only three colors (white, girs, black).
The second is a matrix that contains the electric field and a much larger values (from 0 to 1500). I trace with contourf (X, Y, field). I need, in order to see clearly, more than 3 color. So I would like to use the colorbar (jet) for this curve.
The problem is that I want to superimpose the two curves, and if I do: hold on; colorbar (mycolorbar); contour (X, Y, domains, 2); colorbar (jet); contourf (X, Y, field); The jet colorbar applies to both, and I do not see the features of the contour function (X, Y, domains, 2).
Do you know how can I do?
Thank you and good day

답변 (2개)

Patrick Kalita
Patrick Kalita 2011년 10월 21일
The issue arises from the fact that the colormap is a per figure (as opposed to per axes or per object) property. This support document outlines one way to try to work around the issue, but I'll admit it is rather complicated. You can also have a look at freezeColors on the File Exchange.

Rémi BERTRAND
Rémi BERTRAND 2018년 10월 16일
You can just add "hold on"

카테고리

Help CenterFile Exchange에서 Contour Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by