Tags down


How to save multiple subplots at full bit depth

By : joe
Date : August 02 2020, 03:00 AM
around this issue Your image is indeed 16-bit, but it is low in contrast which is why it looks "flat grey". You can run it through ImageMagick identify like this. I have added arrows on the right pointing to the salient parts.
code :
magick identify -verbose sample.png               # omit "magick" if still using v6
Image: sample.png
  Format: PNG (Portable Network Graphics)
  Mime type: image/png
  Class: DirectClass
  Geometry: 1920x1080+0+0
  Units: Undefined
  Colorspace: Gray
  Type: Grayscale
  Base type: Undefined
  Endianess: Undefined
  Depth: 16-bit                               <--- 16-bit
  Channel depth:
    Gray: 16-bit
  Channel statistics:
    Pixels: 2073600
      min: 27916  (0.425971)                  <--- min 27,916 of 65,535
      max: 44722 (0.682414)                   <--- max 44,722 of 65,535
      mean: 30629.2 (0.467372)
      standard deviation: 297.459 (0.00453893)
      kurtosis: 219.144
      skewness: 6.43389
      entropy: 0.811496
  Rendering intent: Undefined
  Gamma: 0.454545
  Matte color: grey74
  Background color: white
  Border color: srgb(223,223,223)
  Transparent color: none
  Interlace: None
  Intensity: Undefined
  Compose: Over
  Page geometry: 1920x1080+0+0
  Dispose: Undefined
  Iterations: 0
  Compression: Zip
  Orientation: Undefined
    date:create: 2020-02-28T08:17:02+00:00
    date:modify: 2020-02-28T08:17:01+00:00
    png:IHDR.bit-depth-orig: 16
    png:IHDR.bit_depth: 16
    png:IHDR.color-type-orig: 0
    png:IHDR.color_type: 0 (Grayscale)
    png:IHDR.interlace_method: 0 (Not interlaced)
    png:IHDR.width,height: 1920, 1080
    signature: bfd36a4055d8bb31695bbed19738063efd9e842d4beec01c5d5123d32f1df42f
    verbose: true
  Tainted: False
  Filesize: 3.96262MiB
  Number pixels: 2073600
  Pixels per second: 75.0272MP
  User time: 0.020u
  Elapsed time: 0:01.027
  Version: ImageMagick 7.0.9-6 Q16 x86_64 2019-11-27 https://imagemagick.org

Share : facebook icon twitter icon

Multiple Subplots with (Sub-)Subplots (MATLAB)

By : sumit sharma
Date : March 29 2020, 07:55 AM
this will help You'll probably find that you are trying to fit too much data onto one figure, and the plots will be too small to see anything of interest. However, a techniques that works, and will give you the option of having individual figures, and combining them into one figure if you wish, is to use individual figures each with a panel on it, then use copyobj to copy to your main figure.
For example,
code :
% Create first figure
hf_sub(1) = figure(1);
hp(1) = uipanel('Parent',hf_sub(1),'Position',[0 0 1 1]);

% Create second figure
hf_sub(2) = figure(2);
hp(2) = uipanel('Parent',hf_sub(2),'Position',[0 0 1 1]);

% Create combined figure
hf_main = figure(3);
npanels = numel(hp);
hp_sub = nan(1,npanels);
% Copy over the panels
for idx = 1:npanels
    hp_sub(idx) = copyobj(hp(idx),hf_main);

Display/Save multiple figures with multiple subplots (matplotlib / python)

By : Hearticy
Date : March 29 2020, 07:55 AM
I think the issue was by ths following , You could create the subplots first using fig, axes = plt.subplots(numrows, numcols). axes will then be an array of subplots which you can iterate over and plot whatever you like.
Note: The number of rows and columns must be integers
code :
filters = units.shape[3]
n_columns = 6
n_rows = int(math.ceil(filters / n_columns) + 1)
fig, axes = plt.subplots(n_rows, n_columns, figsize=(20, 20))

for i, ax in enumerate(axes.flatten()):
    if i>=filters:
        ax.set_title('Filter' + str(i))
        ax.imshow(units[0, :, :, i], interpolation="nearest", cmap="gray")

In vulkan: I want save a depth image to file, but always got a error depth image

By : Ajit
Date : March 29 2020, 07:55 AM
Hope this helps Assuming you've done all the transfer work correctly, your mapped data is basically an array of floats. This is reflected in your code by this line:
float *row = (float*)data;
code :
uint8_t map(float f) {
  return (uint8_t)(f * 255.0f);
uint8_t grey = map(*row);
file.write(&grey, 1);
file.write(&grey, 1);
file.write(&grey, 1);
vec3 colorWheel(float normalizedHue) {
    float v = normalizedHue * 6.f;
    if (v < 0.f) {
        return vec3(1.f, 0.f, 0.f);
    } else if (v < 1.f) {
        return vec3(1.f, v, 0.f);
    } else if (v < 2.f) {
        return vec3(1.f - (v-1.f), 1.f, 0.f);
    } else if (v < 3.f) {
        return vec3(0.f, 1.f, (v-2.f));
    } else if (v < 4.f) {
        return vec3(0.f, 1.f - (v-3.f), 1.f );
    } else if (v < 5.f) {
        return vec3((v-4.f), 0.f, 1.f );
    } else if (v < 6.f) {
        return vec3(1.f, 0.f, 1.f - (v-5.f));
    } else {
        return vec3(1.f, 0.f, 0.f);
vec3 color = colorWheel(*row);
uint8_t r = map(color.r);
uint8_t g = map(color.g);
uint8_t b = map(color.b);
file.write(&r, 1);
file.write(&g, 1);
file.write(&b, 1);

How do I stack multiple subplots (10+ subplots)

By : Tadeu Gois
Date : March 29 2020, 07:55 AM
wish helps you The subplot function uses 3 parameters: subplot(x,y,n), with x being the number of rows, y the number of columns and n the position of your current plot. So by using subplot(2, 1, i), you're telling Matplotlib that you want 2 subplots (one above the other). What you want to do is either input the value by hands to have a grid. I made a function back then to automatically compute the optimal values of x and y in order to have a square display (or what would be the closest to a square):
code :
size = len(my_array_of_values)

final_x = 0

for i in range(10):
    if pow(i,2) < size:
        final_x += 1

final_y = ceil(size / final_x)

fig, axs = plt.subplots(final_y, final_x, sharex=False, sharey=False)

save multiple figures with subplots into a pdf with multiple pages

By : user3370280
Date : March 29 2020, 07:55 AM
it helps some times Combining your code and the link you gave, this saves one pdf (output.pdf) with 5 pages, and on each page there is one figure:
code :
import matplotlib.backends.backend_pdf
pdf = matplotlib.backends.backend_pdf.PdfPages("output.pdf")
import numpy as np
import matplotlib.pyplot as plt

def generate_data():
    return np.random.randint(10, size=10)

figs = []
n_figs = 5

for j in range(n_figs): # create all figures

    plt.suptitle("figure {}" .format(j+1))
    for i in range(4):
        plt.subplot(2, 2, i + 1)

for fig in range(0, plt.gcf().number + 1): # loop over all figures
    pdf.savefig( fig ) # save each figure in the pdf
for j in range(n_figs): # create all figures

    plt.suptitle("figure {}" .format(j+1))
    for i in range(4):
        plt.subplot(2, 2, i + 1)
    pdf.savefig(j) # save on the fly
    plt.close() # close figure once saved


plt.figure(1) # create figure outside loop

for j in range(n_figs): # create all figures

    plt.suptitle("figure {}" .format(j+1))
    for i in range(4):
        plt.subplot(2, 2, i + 1)
    pdf.savefig(1) # save on the fly
    plt.clf() # clear figure once saved


Related Posts Related Posts :
  • Print a table with aligned columns in python
  • Entity Linking with spacy/Wikipedia
  • Question about "running times" of a for loop
  • Best way to .clean and .strip long string?
  • Jupyter Labs: Kernel Dies when Converting Tuple to PandasData Frame
  • Writing a CSV table from column variables?
  • Calling a function using a dictionary - dictionary keys as its parameters, dictionary values as its arguments
  • if error then do something else - string split
  • Filling values in a column
  • What are these set operations, and why do they give different results?
  • How can I run a function forever?
  • For loop resulting in wrong output
  • How to vectorize this simple NumPy function?
  • Matplotlib: creating a scatter plot where each point is colored (weighted) based on its count of instances in the datase
  • other possible way to duplicate a string from one variable in python
  • Cannot delete the column in DataFrame Pandas by del function
  • How to convert a string into ASCII?
  • Assigning values to a new column in Pandas
  • Django 3 - Making Model's FK Dropdown Display Current User's Data Only
  • Python Error of unsupported operand types for *: 'Nonetype' and 'Float' with array problem
  • Python in Jupyter Notebooks: 'Table' is not defined
  • Extract ID and value from set of strings in an array
  • finding the position of an element within a numpy array in python
  • Cannot run apache airflow after fresh install, python import error
  • Replace climbing sequence with its average
  • How to create a new column with a conditional count in a groupby pandas dataFrame
  • In python how to mix two sentence?
  • returning the 2nd letter in a string in a list and sorted the words by it. keep getting indexing range out of bound. Pyt
  • Convert string in an a tuple into an integer
  • Comparison using modifiable signs (python)
  • Python Beginning in new line for each letter in string
  • Byte to integer conversion
  • Why is 1e100+1 == 1e100 if ints do not have a maximum?
  • How to show list of certain items from JSON
  • How to fill a circle contour at the edge of an image?
  • How to BEST extract information from multiple dataframes based on a series of if\else conditions and matching values? (G
  • Convert string to few variables with pattern
  • Python Deleting Multiple Lines
  • How to replace a string based on first and last character
  • How can I resolve problem with tag_add in Tkinter
  • Check if csv file is empty in pandas
  • pd.NA vs np.nan for pandas
  • How to not display () and '
  • How to write a large dask array (numpy.ndarray) to a Zarr file leveraging GPUs?
  • How to crop circle image from webcam OpenCV and remove background
  • Can we login on a website with pure Python urllib, modify some form values, and submit? (without Selenium browser automa
  • Python: Fastest way of packing a 2d array of binary values into UINT64 array
  • Using global variable from one python file to another
  • How to add "<>" symbols to a string?
  • "IndexError: list assignment index out of range" in python
  • counting of elements (strings) in list python
  • if a certain columns's var is lower then n i want to drop that column
  • ValueError: Units 'M' and 'Y' are no longer supported, as they do not represent unambiguous timedelta values durations
  • How I get data in one column and put into a list using pandas?
  • What takes more memory, an 8 char string or 8 digit int?
  • I want to know what is the purpose of lambda x=x in the below code?
  • Pandas groupby select top N rows based on column value AND group size share
  • Appending to list produces None
  • Multiply List of RGB values Python
  • shadow
    Privacy Policy - Terms - Contact Us © voile276.org