How can I draw a horizontal line in a filled contour plot and label it?


Daniel Valencia C.

I have the following contour plot

x <- c(0,25,50,75,100)
y <- c(0,10,20)
z <- matrix(c(12,12,13,12,5,12,5,5,5,12,5,12,13,14,15), nrow = 5, ncol = 3, byrow = TRUE)
A <- matrix(seq(0, 100, by = 25), nrow = 3, ncol = 5, byrow = TRUE) #As x
B <- matrix(seq(0,20, by = 10), nrow = 3, ncol = 5) #As y
filled.contour(x,y,z, color=terrain.colors,#
  plot.axes = { axis(1); axis(2); points(A,B)})

How can I draw a level line around a level with a value of 5 and label it and get something like this:

enter image description here

Henrik

You can add that line contourat exactly 5. It's impossible to add that line, so I used 5.01 instead and specified plot.axes. labelsthat 's the principle at least.

filled.contour(x, y, z, color = terrain.colors,
               plot.axes = {axis(1); axis(2); points(A, B);
                 contour(x, y, z, levels = 5.01, labels = "5", col = "red", add = TRUE)})

enter image description here

Related


How can I draw a horizontal line around the icon?

username I am trying to draw two solid lines on the ech side of an icon using the following code. But when I show the lilabel as inline-block, the line disappears. .icon-wrapper { display: table; left: 50%; top: 50%; margin: -13px 0 0 -13px; height:

How can I draw a horizontal line around the icon?

username I am trying to draw two solid lines on the ech side of an icon using the following code. But when I show the lilabel as inline-block, the line disappears. .icon-wrapper { display: table; left: 50%; top: 50%; margin: -13px 0 0 -13px; height:

How can I (correctly) draw a line plot from a pandas dataframe?

Peled I am plotting a line graph from a pandas dataframe. However, the labels overlap on the right side of the x-axis instead of the relative point labels on the line. What is missing? Here is the complete code and pictures #importing pandas package import pan

How to draw horizontal line for each line in pandas plot?

learner I need to draw a horizontal line starting from the first point of each line drawn below. The line goes from the first xticks to the last x-ticks. To use ax.hlines(), I need to know xmaxand and xmindon't know if the x value is categorical. How to draw t

How to draw horizontal line for each line in pandas plot?

learner I need to draw a horizontal line starting from the first point of each line drawn below. The line goes from the first xticks to the last x-ticks. To use ax.hlines(), I need to know xmaxand and xmindon't know if the x value is categorical. How to draw t

How to draw horizontal line for each line in pandas plot?

learner I need to draw a horizontal line starting from the first point of each line drawn below. The line goes from the first xticks to the last x-ticks. To use ax.hlines(), I need to know xmaxand and xmindon't know if the x value is categorical. How to draw t

How to draw horizontal line for each line in pandas plot?

learner I need to draw a horizontal line starting from the first point of each line drawn below. The line goes from the first xticks to the last x-ticks. To use ax.hlines(), I need to know xmaxand and xmindon't know if the x value is categorical. How to draw t

How can I draw a line/draw on an image?

Rajash Mappu So far, I've been able to draw lines on a normal image, just like creating my own normal context of size CGRect and drawing lines on it. All the tutorials I've seen are how to draw on a created image context of size x*y. But I want to draw lines o

Draw horizontal mean/average line on scatter plot

Yi Hong Quek I am trying to draw a horizontal line across all the averages of blue and red data points. Now it looks like this This is my code above fig=plt.figure(figsize=(20,10), dpi=100) ax=fig.add_axes([0,0,1,1]) ax.scatter(x='Speed', y='Port ME Homemade M

How can I change the x-axis limits in the contour plot?

Kunal Singhal I want my plot to also show 7000 on the x-axis, since there are more than 6000 values in the data. I try to use, set_xlim(right = 7000)but an error pops up 'QuadContourSet' object has no attribute 'set_xlim' import numpy as np import matplotlib.p

How can I change the x-axis limits in the contour plot?

Kunal Singhal I want my plot to also show 7000 on the x-axis, since there are more than 6000 values in the data. I try to use, set_xlim(right = 7000)but an error pops up 'QuadContourSet' object has no attribute 'set_xlim' import numpy as np import matplotlib.p

Contour plot not fully filled with ggplot

Daniel Valencia C. I'm trying to do my first filled contour plot using ggplot. Based on my data, I'm selecting something like: But my result is: a <- c(1, 1.1, 1, 1.3, 1.2, 2, 2.2, 2, 2.5, 2.1, 3, 3, 3, 3.1, 3.2) b <- c(rep(c(0, 5, 10, 15, 20), 3)) c <- seq(0,

Add abline to filled contour plot

Notolina I drew a contour plot and added a diagonal line: library(MASS) library(fields) x <- c(21.06, 28.89, 23.00, 23.61, 23.61, 22.83, 30.44) y <- c(26.56, 24.00, 13.06, 18.61, 18.61, 14.17, 25.33) z <- kde2d(x, y, n=32, lims = c(0,32,0,32)) contour(z, col =

Contour plot not fully filled with ggplot

Daniel Valencia C. I'm trying to do my first filled contour plot using ggplot. Based on my data, I'm selecting something like: But my result is: a <- c(1, 1.1, 1, 1.3, 1.2, 2, 2.2, 2, 2.5, 2.1, 3, 3, 3, 3.1, 3.2) b <- c(rep(c(0, 5, 10, 15, 20), 3)) c <- seq(0,

Contour plot not fully filled with ggplot

Daniel Valencia C. I'm trying to do my first filled contour plot using ggplot. Based on my data, I'm selecting something like: But my result is: a <- c(1, 1.1, 1, 1.3, 1.2, 2, 2.2, 2, 2.5, 2.1, 3, 3, 3, 3.1, 3.2) b <- c(rep(c(0, 5, 10, 15, 20), 3)) c <- seq(0,

Add abline to filled contour plot

Notolina I drew a contour plot and added a diagonal line: library(MASS) library(fields) x <- c(21.06, 28.89, 23.00, 23.61, 23.61, 22.83, 30.44) y <- c(26.56, 24.00, 13.06, 18.61, 18.61, 14.17, 25.33) z <- kde2d(x, y, n=32, lims = c(0,32,0,32)) contour(z, col =

R: Plot scatter plot on filled contour plot

cure I am very new to R and have made a fill.contour plot using interpolated data (such as the data in plotting contour lines on an irregular grid ) . Using some sample data from plotting contours on an irregular grid , I made fill.contour and a simple scatter

R: Plot scatter plot on filled contour plot

cure I am very new to R and have made a fill.contour plot using interpolated data (such as the data in plotting contour lines on an irregular grid ) . Using some sample data from plotting contours on an irregular grid , I made fill.contour and a simple scatter

R: Plot scatter plot on filled contour plot

cure I'm very new to R and have made a fill.contour plot using interpolated data (such as data in plotting contour lines on an irregular grid ) . Using some sample data from plotting contours on an irregular grid , I made fill.contour and a simple scatter plot

R: Plot scatter plot on filled contour plot

cure I'm very new to R and have made a fill.contour plot using interpolated data (such as data in plotting contour lines on an irregular grid ) . Using some sample data from plotting contours on an irregular grid , I made fill.contour and a simple scatter plot