imshow

Printing one color using imshow [closed]

烈酒焚心 提交于 2020-08-05 05:09:12
问题 Closed. This question needs debugging details. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 3 years ago . Improve this question I want to print a color on the screen using RGB values and the output should be just a single color. For example if I give RGB values of red, I want the output to show me a red color. But when I try this code, it isn't working. What am I missing? import matplotlib.pyplot as plt

Matplotlib imshow colormap not covering full dynamic range of data

泪湿孤枕 提交于 2020-06-27 16:39:11
问题 I'm trying to produce colormaps of numpy arrays with large dynamic ranges. To that end, I've tried using imshow from matplotlib.pyplot , but there appears to be a problem with the colormap. Specifically, every value in the array below a certain threshold is plotted as the same color as the minimum value in the array. Below is a minimal working example. I produce an array containing values from 1e-4 to 1e+20, but in imshow all cells containing values less than 1e+3 appear to be set equal to 1e

Log labels on colorbar matplotlib

淺唱寂寞╮ 提交于 2020-06-12 05:36:09
问题 I have a logarithmic imshow figure, and when the colorbar is created, its axis labels and ticks are logarithmic, but because of the short range (0-50) of the values, the colorbar looks like this: and I would like it to instead show as 0, 5, 10, 20, 50 spaced along the axis (logarithmic spacing). I can't seem to get this to work. Thanks for any help. 回答1: Use the LogFormatter class and set labelOnlyBase to False : import matplotlib.pyplot as plt import numpy as np import matplotlib.colors from

Why does a right click open a drop down menu in my OpenCV imshow() window?

徘徊边缘 提交于 2020-05-30 07:53:13
问题 I am trying to run the OpenCV Grabcut Sample on my system: OpenCV version 4.1.0 Python version 3.6.8 IDLE version 3.6.8 Ubuntu 18.04.2 This is the build information from cv2.getBuildInformation() : In the Grabcut Sample script, I need to 'draw a rectangle around the object using the right mouse button.' For some reason, a drop down menu appears when I click the right mouse button (this is me clicking and holding the right mouse button): This didn't happen before, but since I reformatted my

Missing labels in Matplotlib correlation heatmap

懵懂的女人 提交于 2020-04-07 03:28:49
问题 I'm playing around with the abalone dataset from UCI's machine learning repository. I want to display a correlation heatmap using matplotlib and imshow. The first time I tried it, it worked fine. All the numeric variables plotted and labeled, seen here: fig = plt.figure(figsize=(15,8)) ax1 = fig.add_subplot(111) plt.imshow(df.corr(), cmap='hot', interpolation='nearest') plt.colorbar() labels = df.columns.tolist() ax1.set_xticklabels(labels,rotation=90, fontsize=10) ax1.set_yticklabels(labels

Exception when showing an Image with OpenCV

a 夏天 提交于 2020-01-25 07:26:06
问题 I try to show an Image with the OpenCV-function 'imshow()'. cv::Mat im = cv::imread("/home/franek/Schreibtisch/image.jpg",cv::IMREAD_GRAYSCALE); cv::imshow("original", im); Now it tells me: OpenCV Error: Assertion failed (scn == 3 || scn == 4) in cvtColor, file /build/opencv-L2vuMj/opencv-3.2.0+dfsg/modules/imgproc/src/color.cpp, line 9716 terminate called after throwing an instance of 'cv::Exception' what(): /build/opencv-L2vuMj/opencv-3.2.0+dfsg/modules/imgproc/src/color.cpp:9716: error: (

display matrix values and colormap

别等时光非礼了梦想. 提交于 2020-01-12 03:14:07
问题 I need to display values of my matrix using matshow. However, with the code I have now I just get two matrices - one with values and other colored. How do I impose them? Thanks :) import numpy as np import matplotlib.pyplot as plt fig, ax = plt.subplots() min_val, max_val = 0, 15 for i in xrange(15): for j in xrange(15): c = intersection_matrix[i][j] ax.text(i+0.5, j+0.5, str(c), va='center', ha='center') plt.matshow(intersection_matrix, cmap=plt.cm.Blues) ax.set_xlim(min_val, max_val) ax.set