logo
Tags down

shadow

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
    Gray:
      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
  Properties:
    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
  Artifacts:
    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]);
subplot(2,2,1,'Parent',hp(1));
plot(1:10);
subplot(2,2,2,'Parent',hp(1));
surf(peaks);
subplot(2,2,3,'Parent',hp(1));
membrane;
subplot(2,2,4,'Parent',hp(1));
plot(rand(1,100));

% Create second figure
hf_sub(2) = figure(2);
hp(2) = uipanel('Parent',hf_sub(2),'Position',[0 0 1 1]);
subplot(2,2,1,'Parent',hp(2));
histogram(randn(1,1000));
subplot(2,2,2,'Parent',hp(2));
membrane
subplot(2,2,3,'Parent',hp(2));
surf(peaks)
subplot(2,2,4,'Parent',hp(2));
plot(-(1:10));

% 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);
    set(hp_sub(idx),'Position',[(idx-1)/npanels,0,1/npanels,1]);
end

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.remove()
    else:
        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);
++row;
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);
++row;

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.figure(j)
    plt.suptitle("figure {}" .format(j+1))
    for i in range(4):
        plt.subplot(2, 2, i + 1)
        plt.plot(generate_data())

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

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

pdf.close()

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)
        plt.plot(generate_data())
    pdf.savefig(1) # save on the fly
    plt.clf() # clear figure once saved

pdf.close()

Related Posts Related Posts :
  • Using disabledDate in Antd Datepicker in table
  • iterator .end() from std::list returns "0xcdcdcdcdcdcdcdcd" but .begin() as expected
  • how to convert HAC flexible query to DAO query
  • Cannot refresh UI if update in ItemView
  • How to make a function to use dict keys as variables to a class?
  • Best approach to remove cassandra-topology.properties file in running cluster nodes
  • plsql store procedure loop compare value
  • Replace values in XML file with values of a vector
  • Convert old SQL Database in compatibility mode
  • Sum same property object by group
  • What do you do about the JLabel classes? It says, "JLabel not a statement" for the error
  • Is std::sqrt the same as sqrt in C++
  • Iterate through std::initializer_list
  • Why does the overidden run method in java.lang.Thread produce a bizarre output?
  • Typescript: type one parameter based on the other
  • How to add a CSS to this JavaScript or HTML on click buttons?
  • Is it OK to inherit an empty Interface?
  • Functional Interface call for a new Instance
  • Microsoft Bot Framework: Smilies in MS Teams
  • changing background image of div using javascript
  • How to convert two arrays of strings to the array of objects like key and value with particular keys in javascript?
  • What is the fastest way to find if a column has at least one NULL value in ORACLE database?
  • Rename headers - 'list' object is not callable
  • Codeblocks c++ code doesn't run in VS 19 (vector subscript out of range)
  • Passing res.send value from node.js backend to react.js
  • Vim shortcuts to select and copy the current line without the next line
  • Is it possible to pass data from an angular7 component or service to index.html file?
  • When I tried to add ArrayList into ArrayList second ArrayList is repeating
  • If I implement IEquatable<T>, will I lose the option to compare by reference?
  • Authorize with both ASP.NET core MVC/Razor site AND a WebAPI
  • Compare two version of zip file and find which file has been modified within that zip
  • Dynamically generated href won't show properly
  • Best way to saving completed progress in table?
  • Does UIWindow function not work in Xcode11.3?
  • TypeError: __init__() takes 2 positional arguments but 6 were given
  • Converting string (with timezone) to datetime in python
  • How to overwrite the theme in shopify
  • Get the no of consecutive days a Field value is Stale
  • How to keep track of previous value of variable in swift?
  • Can't get result when running the query from Spring Data Jpa
  • If Condition Simplification
  • Python list generation from two strings
  • How to find distinct records in vespa.ai?
  • Why erase on std::vector promote iterator
  • How to use data to set other data in Vue.js
  • Azure AD does not return groups on claims
  • ASP Net Core Web API: Client side GroupBy is not supported
  • How to correct TypeError: Unicode-objects must be encoded before hashing with ReportLab
  • how to destroy an object in C++
  • How to do pagination using groupby in vespa.ai?
  • How can I print the longest word from a user defined list?
  • C# I have a DLL file and I need to make a class that inherits from a class that's in the DLL file?
  • Can someone explain to me why my factorial recursion code can't be compiled
  • Pass a PHP variable to a JS variable
  • Showing messages based on scroll position
  • How to copy cells via vba macro without getting subscript out of range
  • Replace substring in shell script
  • enabling authentication in ignite
  • Swipe to delete rows with multi section in tableview?
  • [BootstrapVue warn]: popover - Unable to find target element in document
  • shadow
    Privacy Policy - Terms - Contact Us © voile276.org