Open
Description
Bug category
- bug - compilation error
- bug - compilation warning
- bug - runtime error
- bug - runtime warning
- bug - logic error
Describe the bug
In the code below, five examples (replace input0();
with input1();
... input4();
in main()
to load the data for the other examples) demonstrate issues I had with the filed contour plots contourf
. I presume that those issues might be related (or maybe they are not). Apart from that, I'd like to thank you for this excellent library - I was stunned when I stumbled upon the project :) Not having to export examples to a Matlab code to merely check them out there is tremendous help.
Example 0 (input0
):
- Produces a segfault when the figure is generated with
figure(true);
. - GDB says (see also backtrace below) this happens in
matplot::contours::is_lower_level
- In the reactive mode (
figure(false);
), segfault is not produced; however, the calculated levels, as indicated by the colorbar, are garbage. See the produced plot below. - For comparison: the other image for this example is produced by Matlab's
contourf
version on the same data. - It should be noted that
X
,Y
in this example are not produced bymeshgrid
(rather, they correspond to$r\cos(\phi)$ and$r\sin(\phi)$ , where the data for$r$ and$\phi$ are generated bymeshgrid
). I could not produce an example where the segfault happened with data of the fromauto [X, Y] = meshgrid(x, y);
Example 1 (input1
):
- The data are consistent with the output of
meshgrid
; - Now, no segfault, but the levels are still infinite and the produced plot nonsensical (specifically, filling is all wrong; the contours themselves, plotted with solid lines, actually appear OK). See the first plot below.
- It should be noted that now both reactive and quiet mode produce the same figure.
- For comparison, the other figure is generated by Matlab from the same data.
Example 2 (input2
):
- The data are consistent with the output of
meshgrid
; - The calculated levels (as indicated by the colorbar) are now finite (and appear correct). However, the plot is filled improperly, with shaded regions not corresponding to the actual level lines.
- The first image below produced by
matplot++
, the second by Matlab on the same data.
Example 3 (input3
):
- The data are not consistent with the output of
meshgrid
, but of the form$r\cos(\phi)$ and$r\sin(\phi)$ , similarly as in Example 0. For this simple function, the plot is produced (and the levels are finite), but... - The rows in
X
,Y
,Z
correspond to values of$\phi$ , with the first and last being$0$ and$2\pi$ , respectively (similarly as in Example 0). However,matplot++
produces an example with a sector 'cut out', see the first image below. Matlab on the same data produces a correct contour plot. - The generated data in this example (and also Example 0) contain also two identical (up to numerical accuracy) rows corresponding to
$\phi=\pi$ (as well as for$\phi \in {0,2\pi}$ , of course); I did play around with the examples either by removing the identical rows (or making them truly identical, instead of up to$10^{-15}$ precision), but it did not help (also, the segfault in Example 0 was generated in all these variants).
Example 4 (input4
):
- This is to be contrasted with Example 3: the cutout issue is solved by adding an additional row, duplicate of the first nonzero value of
$\phi$ (i.e., we essentially doX.push_back(X[1]);
for all arrays in Example 3). - Now
matplot++
produces a correct plot (see below); also so does Matlab on the same data (and the resulting plot is identical toimg3M
above). - In Example 0, such an addition of extra rows does not help with the segfault, however.
Additional notes
- In Examples 1-4, both
figure(false);
andfigure(true);
reproduce the same behavior, i.e., the improper filling does not depend upon the mode for figure. - If one uncomments
//contourf(X,Y,Z);
but comments out the three lines above, the behavior is the same in all examples. - I did notice there have been some issues with
contourf
and even thematplot::contours::is_lower_level
member (e.g., the open issue axes_objects/contourc.cpp:584: out-of-bounds while accessing the _Z_rows[n_col][n_row] in contours::is_lower_level() #77 - but not sure if it is related) - For reporting purposes, the
matplot++
library was built withCMAKE_BUILD_TYPE=Debug
(but the bug was present also on the Release version):
cmake .. -DCMAKE_BUILD_TYPE=Debug -DBUILD_EXAMPLES=OFF -DBUILD_TESTS=OFF
cmake --build . --parallel 2 --config Debug
- Finally, the non-filled version
contour(X,Y,Z)
in all examples and settings worked perfectly.
Steps to Reproduce
Source code and data:
#include <matplot/matplot.h>
#include <thread>
std::vector< std::vector<double> > X,Y,Z;
void input0(){
X={
{0, 0.666667, 1.33333, 2},
{0, 0.471405, 0.942809, 1.41421},
{0, 4.08216e-17, 8.16431e-17, 1.22465e-16},
{-0, -0.471405, -0.942809, -1.41421},
{-0, -0.666667, -1.33333, -2},
{-0, -0.666667, -1.33333, -2},
{-0, -0.471405, -0.942809, -1.41421},
{-0, -4.08216e-17, -8.16431e-17, -1.22465e-16},
{0, 0.471405, 0.942809, 1.41421},
{0, 0.666667, 1.33333, 2},
};
Y={
{0, 0, 0, 0},
{0, 0.471405, 0.942809, 1.41421},
{0, 0.666667, 1.33333, 2},
{0, 0.471405, 0.942809, 1.41421},
{0, 8.16431e-17, 1.63286e-16, 2.44929e-16},
{-0, -0, -0, -0},
{-0, -0.471405, -0.942809, -1.41421},
{-0, -0.666667, -1.33333, -2},
{-0, -0.471405, -0.942809, -1.41421},
{-0, -8.16431e-17, -1.63286e-16, -2.44929e-16},
};
Z={
{-0.806291, 0.109974, 0.00975164, 1.56284e-07},
{-0.806291, -0.413175, 0.0112942, 1.74055e-07},
{-0.806291, 0.602772, 0.0195515, 2.30858e-07},
{-0.806291, 1.52672, 0.028121, 2.89551e-07},
{-0.806291, 0.911565, 0.0299758, 3.09213e-07},
{-0.806291, 0.911565, 0.0299758, 3.09213e-07},
{-0.806291, 1.52672, 0.028121, 2.89551e-07},
{-0.806291, 0.602772, 0.0195515, 2.30858e-07},
{-0.806291, -0.413175, 0.0112942, 1.74055e-07},
{-0.806291, 0.109974, 0.00975164, 1.56284e-07},
};
}
void input1(){
X={
{-2, -0.666667, 0.666667, 2},
{-2, -0.666667, 0.666667, 2},
{-2, -0.666667, 0.666667, 2},
{-2, -0.666667, 0.666667, 2},
{-2, -0.666667, 0.666667, 2},
{-2, -0.666667, 0.666667, 2},
{-2, -0.666667, 0.666667, 2},
{-2, -0.666667, 0.666667, 2},
{-2, -0.666667, 0.666667, 2},
{-2, -0.666667, 0.666667, 2},
{-2, -0.666667, 0.666667, 2},
};
Y={
{-2, -2, -2, -2},
{-1.6, -1.6, -1.6, -1.6},
{-1.2, -1.2, -1.2, -1.2},
{-0.8, -0.8, -0.8, -0.8},
{-0.4, -0.4, -0.4, -0.4},
{0, 0, 0, 0},
{0.4, 0.4, 0.4, 0.4},
{0.8, 0.8, 0.8, 0.8},
{1.2, 1.2, 1.2, 1.2},
{1.6, 1.6, 1.6, 1.6},
{2, 2, 2, 2},
};
Z={
{2.39185e-09, 0.00276597, 0.00313371, 2.49509e-09},
{1.14939e-06, -0.000477293, 0.0292385, 1.21027e-06},
{7.41466e-05, 0.0886575, -0.116372, 8.19955e-05},
{0.000842403, -0.163246, 0.857009, 0.00115847},
{0.0026183, 0.855871, 0.829974, 0.00590244},
{0.00354349, 1.16218, 1.1377, 0.0109249},
{0.0026183, 0.855871, 0.829974, 0.00590244},
{0.000842403, -0.163246, 0.857009, 0.00115847},
{7.41466e-05, 0.0886575, -0.116372, 8.19955e-05},
{1.14939e-06, -0.000477293, 0.0292385, 1.21027e-06},
{2.39185e-09, 0.00276597, 0.00313371, 2.49509e-09},
};
}
void input2(){
X={
{-1.7, -1.13333, -0.566667, 0, 0.566667, 1.13333, 1.7},
{-1.7, -1.13333, -0.566667, 0, 0.566667, 1.13333, 1.7},
{-1.7, -1.13333, -0.566667, 0, 0.566667, 1.13333, 1.7},
{-1.7, -1.13333, -0.566667, 0, 0.566667, 1.13333, 1.7},
{-1.7, -1.13333, -0.566667, 0, 0.566667, 1.13333, 1.7},
{-1.7, -1.13333, -0.566667, 0, 0.566667, 1.13333, 1.7},
{-1.7, -1.13333, -0.566667, 0, 0.566667, 1.13333, 1.7},
{-1.7, -1.13333, -0.566667, 0, 0.566667, 1.13333, 1.7},
{-1.7, -1.13333, -0.566667, 0, 0.566667, 1.13333, 1.7},
{-1.7, -1.13333, -0.566667, 0, 0.566667, 1.13333, 1.7},
{-1.7, -1.13333, -0.566667, 0, 0.566667, 1.13333, 1.7},
};
Y={
{-1.7, -1.7, -1.7, -1.7, -1.7, -1.7, -1.7},
{-1.36, -1.36, -1.36, -1.36, -1.36, -1.36, -1.36},
{-1.02, -1.02, -1.02, -1.02, -1.02, -1.02, -1.02},
{-0.68, -0.68, -0.68, -0.68, -0.68, -0.68, -0.68},
{-0.34, -0.34, -0.34, -0.34, -0.34, -0.34, -0.34},
{0, 0, 0, 0, 0, 0, 0},
{0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34},
{0.68, 0.68, 0.68, 0.68, 0.68, 0.68, 0.68},
{1.02, 1.02, 1.02, 1.02, 1.02, 1.02, 1.02},
{1.36, 1.36, 1.36, 1.36, 1.36, 1.36, 1.36},
{1.7, 1.7, 1.7, 1.7, 1.7, 1.7, 1.7},
};
Z={
{2.47695e-05, 0.00347924, 0.0159238, 0.111652, 0.0425439, 0.00328751, 2.45727e-05},
{0.000702989, -0.000339059, -0.0441639, 0.400753, 0.042592, -0.00320279, 0.000646919},
{0.00421222, -0.00897225, -0.0292202, 1.01869, 0.400494, 0.100793, 0.00329369},
{0.00947364, -0.0427793, 0.262785, 1.1254, 1.25067, -0.131926, 0.00828156},
{0.0185485, -0.00292027, 1.21314, 1.0483, 0.332686, 0.473086, 0.054183},
{0.0252676, 0.757398, 1.30105, 0.840936, 1.16737, 1.09964, 0.11956},
{0.0185485, -0.00292027, 1.21314, 1.0483, 0.332686, 0.473086, 0.054183},
{0.00947364, -0.0427793, 0.262785, 1.1254, 1.25067, -0.131926, 0.00828156},
{0.00421222, -0.00897225, -0.0292202, 1.01869, 0.400494, 0.100793, 0.00329369},
{0.000702989, -0.000339059, -0.0441639, 0.400753, 0.042592, -0.00320279, 0.000646919},
{2.47695e-05, 0.00347924, 0.0159238, 0.111652, 0.0425439, 0.00328751, 2.45727e-05},
};
}
void input3(){
X={
{0, 1.66667, 3.33333, 5, 6.66667, 8.33333, 10},
{0, 1.58509, 3.17019, 4.75528, 6.34038, 7.92547, 9.51057},
{0, 1.34836, 2.69672, 4.04508, 5.39345, 6.74181, 8.09017},
{0, 0.979642, 1.95928, 2.93893, 3.91857, 4.89821, 5.87785},
{0, 0.515028, 1.03006, 1.54508, 2.06011, 2.57514, 3.09017},
{0, 1.02054e-16, 2.04108e-16, 3.06162e-16, 4.08216e-16, 5.10269e-16, 6.12323e-16},
{-0, -0.515028, -1.03006, -1.54508, -2.06011, -2.57514, -3.09017},
{-0, -0.979642, -1.95928, -2.93893, -3.91857, -4.89821, -5.87785},
{-0, -1.34836, -2.69672, -4.04508, -5.39345, -6.74181, -8.09017},
{-0, -1.58509, -3.17019, -4.75528, -6.34038, -7.92547, -9.51057},
{-0, -1.66667, -3.33333, -5, -6.66667, -8.33333, -10},
{-0, -1.66667, -3.33333, -5, -6.66667, -8.33333, -10},
{-0, -1.58509, -3.17019, -4.75528, -6.34038, -7.92547, -9.51057},
{-0, -1.34836, -2.69672, -4.04508, -5.39345, -6.74181, -8.09017},
{-0, -0.979642, -1.95928, -2.93893, -3.91857, -4.89821, -5.87785},
{-0, -0.515028, -1.03006, -1.54508, -2.06011, -2.57514, -3.09017},
{-0, -1.02054e-16, -2.04108e-16, -3.06162e-16, -4.08216e-16, -5.10269e-16, -6.12323e-16},
{0, 0.515028, 1.03006, 1.54508, 2.06011, 2.57514, 3.09017},
{0, 0.979642, 1.95928, 2.93893, 3.91857, 4.89821, 5.87785},
{0, 1.34836, 2.69672, 4.04508, 5.39345, 6.74181, 8.09017},
{0, 1.58509, 3.17019, 4.75528, 6.34038, 7.92547, 9.51057},
{0, 1.66667, 3.33333, 5, 6.66667, 8.33333, 10},
};
Y={
{0, 0, 0, 0, 0, 0, 0},
{0, 0.515028, 1.03006, 1.54508, 2.06011, 2.57514, 3.09017},
{0, 0.979642, 1.95928, 2.93893, 3.91857, 4.89821, 5.87785},
{0, 1.34836, 2.69672, 4.04508, 5.39345, 6.74181, 8.09017},
{0, 1.58509, 3.17019, 4.75528, 6.34038, 7.92547, 9.51057},
{0, 1.66667, 3.33333, 5, 6.66667, 8.33333, 10},
{0, 1.58509, 3.17019, 4.75528, 6.34038, 7.92547, 9.51057},
{0, 1.34836, 2.69672, 4.04508, 5.39345, 6.74181, 8.09017},
{0, 0.979642, 1.95928, 2.93893, 3.91857, 4.89821, 5.87785},
{0, 0.515028, 1.03006, 1.54508, 2.06011, 2.57514, 3.09017},
{0, 2.04108e-16, 4.08216e-16, 6.12323e-16, 8.16431e-16, 1.02054e-15, 1.22465e-15},
{-0, -0, -0, -0, -0, -0, -0},
{-0, -0.515028, -1.03006, -1.54508, -2.06011, -2.57514, -3.09017},
{-0, -0.979642, -1.95928, -2.93893, -3.91857, -4.89821, -5.87785},
{-0, -1.34836, -2.69672, -4.04508, -5.39345, -6.74181, -8.09017},
{-0, -1.58509, -3.17019, -4.75528, -6.34038, -7.92547, -9.51057},
{-0, -1.66667, -3.33333, -5, -6.66667, -8.33333, -10},
{-0, -1.58509, -3.17019, -4.75528, -6.34038, -7.92547, -9.51057},
{-0, -1.34836, -2.69672, -4.04508, -5.39345, -6.74181, -8.09017},
{-0, -0.979642, -1.95928, -2.93893, -3.91857, -4.89821, -5.87785},
{-0, -0.515028, -1.03006, -1.54508, -2.06011, -2.57514, -3.09017},
{-0, -2.04108e-16, -4.08216e-16, -6.12323e-16, -8.16431e-16, -1.02054e-15, -1.22465e-15},
};
Z={
{-0.806291, 9.5359e-05, 1.72896e-25, 2.75652e-62, 1.4149e-114, 3.34493e-182, 4.24539e-265},
{-0.806291, 9.71048e-05, 1.74691e-25, 2.77522e-62, 1.42198e-114, 3.35818e-182, 4.25929e-265},
{-0.806291, 0.000103195, 1.8006e-25, 2.83019e-62, 1.44269e-114, 3.39683e-182, 4.29978e-265},
{-0.806291, 0.000115283, 1.88834e-25, 2.91769e-62, 1.47537e-114, 3.45753e-182, 4.36324e-265},
{-0.806291, 0.00013386, 2.00433e-25, 3.03048e-62, 1.51711e-114, 3.53475e-182, 4.44375e-265},
{-0.806291, 0.000156898, 2.13719e-25, 3.15761e-62, 1.56387e-114, 3.62099e-182, 4.53353e-265},
{-0.806291, 0.000180277, 2.2713e-25, 3.28557e-62, 1.61087e-114, 3.70758e-182, 4.6236e-265},
{-0.806291, 0.000199744, 2.39057e-25, 3.40054e-62, 1.65322e-114, 3.7857e-182, 4.7049e-265},
{-0.806291, 0.000212931, 2.48237e-25, 3.49073e-62, 1.68665e-114, 3.84752e-182, 4.76933e-265},
{-0.806291, 0.000219911, 2.53935e-25, 3.54788e-62, 1.70797e-114, 3.88706e-182, 4.81061e-265},
{-0.806291, 0.000221996, 2.55856e-25, 3.56741e-62, 1.71529e-114, 3.90066e-182, 4.82481e-265},
{-0.806291, 0.000221996, 2.55856e-25, 3.56741e-62, 1.71529e-114, 3.90066e-182, 4.82481e-265},
{-0.806291, 0.000219911, 2.53935e-25, 3.54788e-62, 1.70797e-114, 3.88706e-182, 4.81061e-265},
{-0.806291, 0.000212931, 2.48237e-25, 3.49073e-62, 1.68665e-114, 3.84752e-182, 4.76933e-265},
{-0.806291, 0.000199744, 2.39057e-25, 3.40054e-62, 1.65322e-114, 3.7857e-182, 4.7049e-265},
{-0.806291, 0.000180277, 2.2713e-25, 3.28557e-62, 1.61087e-114, 3.70758e-182, 4.6236e-265},
{-0.806291, 0.000156898, 2.13719e-25, 3.15761e-62, 1.56387e-114, 3.62099e-182, 4.53353e-265},
{-0.806291, 0.00013386, 2.00433e-25, 3.03048e-62, 1.51711e-114, 3.53475e-182, 4.44375e-265},
{-0.806291, 0.000115283, 1.88834e-25, 2.91769e-62, 1.47537e-114, 3.45753e-182, 4.36324e-265},
{-0.806291, 0.000103195, 1.8006e-25, 2.83019e-62, 1.44269e-114, 3.39683e-182, 4.29978e-265},
{-0.806291, 9.71048e-05, 1.74691e-25, 2.77522e-62, 1.42198e-114, 3.35818e-182, 4.25929e-265},
{-0.806291, 9.5359e-05, 1.72896e-25, 2.75652e-62, 1.4149e-114, 3.34493e-182, 4.24539e-265},
};
}
void input4(){
X={
{0, 1.66667, 3.33333, 5, 6.66667, 8.33333, 10},
{0, 1.58509, 3.17019, 4.75528, 6.34038, 7.92547, 9.51057},
{0, 1.34836, 2.69672, 4.04508, 5.39345, 6.74181, 8.09017},
{0, 0.979642, 1.95928, 2.93893, 3.91857, 4.89821, 5.87785},
{0, 0.515028, 1.03006, 1.54508, 2.06011, 2.57514, 3.09017},
{0, 1.02054e-16, 2.04108e-16, 3.06162e-16, 4.08216e-16, 5.10269e-16, 6.12323e-16},
{-0, -0.515028, -1.03006, -1.54508, -2.06011, -2.57514, -3.09017},
{-0, -0.979642, -1.95928, -2.93893, -3.91857, -4.89821, -5.87785},
{-0, -1.34836, -2.69672, -4.04508, -5.39345, -6.74181, -8.09017},
{-0, -1.58509, -3.17019, -4.75528, -6.34038, -7.92547, -9.51057},
{-0, -1.66667, -3.33333, -5, -6.66667, -8.33333, -10},
{-0, -1.66667, -3.33333, -5, -6.66667, -8.33333, -10},
{-0, -1.58509, -3.17019, -4.75528, -6.34038, -7.92547, -9.51057},
{-0, -1.34836, -2.69672, -4.04508, -5.39345, -6.74181, -8.09017},
{-0, -0.979642, -1.95928, -2.93893, -3.91857, -4.89821, -5.87785},
{-0, -0.515028, -1.03006, -1.54508, -2.06011, -2.57514, -3.09017},
{-0, -1.02054e-16, -2.04108e-16, -3.06162e-16, -4.08216e-16, -5.10269e-16, -6.12323e-16},
{0, 0.515028, 1.03006, 1.54508, 2.06011, 2.57514, 3.09017},
{0, 0.979642, 1.95928, 2.93893, 3.91857, 4.89821, 5.87785},
{0, 1.34836, 2.69672, 4.04508, 5.39345, 6.74181, 8.09017},
{0, 1.58509, 3.17019, 4.75528, 6.34038, 7.92547, 9.51057},
{0, 1.66667, 3.33333, 5, 6.66667, 8.33333, 10},
{0, 1.58509, 3.17019, 4.75528, 6.34038, 7.92547, 9.51057},
};
Y={
{0, 0, 0, 0, 0, 0, 0},
{0, 0.515028, 1.03006, 1.54508, 2.06011, 2.57514, 3.09017},
{0, 0.979642, 1.95928, 2.93893, 3.91857, 4.89821, 5.87785},
{0, 1.34836, 2.69672, 4.04508, 5.39345, 6.74181, 8.09017},
{0, 1.58509, 3.17019, 4.75528, 6.34038, 7.92547, 9.51057},
{0, 1.66667, 3.33333, 5, 6.66667, 8.33333, 10},
{0, 1.58509, 3.17019, 4.75528, 6.34038, 7.92547, 9.51057},
{0, 1.34836, 2.69672, 4.04508, 5.39345, 6.74181, 8.09017},
{0, 0.979642, 1.95928, 2.93893, 3.91857, 4.89821, 5.87785},
{0, 0.515028, 1.03006, 1.54508, 2.06011, 2.57514, 3.09017},
{0, 2.04108e-16, 4.08216e-16, 6.12323e-16, 8.16431e-16, 1.02054e-15, 1.22465e-15},
{-0, -0, -0, -0, -0, -0, -0},
{-0, -0.515028, -1.03006, -1.54508, -2.06011, -2.57514, -3.09017},
{-0, -0.979642, -1.95928, -2.93893, -3.91857, -4.89821, -5.87785},
{-0, -1.34836, -2.69672, -4.04508, -5.39345, -6.74181, -8.09017},
{-0, -1.58509, -3.17019, -4.75528, -6.34038, -7.92547, -9.51057},
{-0, -1.66667, -3.33333, -5, -6.66667, -8.33333, -10},
{-0, -1.58509, -3.17019, -4.75528, -6.34038, -7.92547, -9.51057},
{-0, -1.34836, -2.69672, -4.04508, -5.39345, -6.74181, -8.09017},
{-0, -0.979642, -1.95928, -2.93893, -3.91857, -4.89821, -5.87785},
{-0, -0.515028, -1.03006, -1.54508, -2.06011, -2.57514, -3.09017},
{-0, -2.04108e-16, -4.08216e-16, -6.12323e-16, -8.16431e-16, -1.02054e-15, -1.22465e-15},
{0, 0.515028, 1.03006, 1.54508, 2.06011, 2.57514, 3.09017},
};
Z={
{-0.806291, 9.5359e-05, 1.72896e-25, 2.75652e-62, 1.4149e-114, 3.34493e-182, 4.24539e-265},
{-0.806291, 9.71048e-05, 1.74691e-25, 2.77522e-62, 1.42198e-114, 3.35818e-182, 4.25929e-265},
{-0.806291, 0.000103195, 1.8006e-25, 2.83019e-62, 1.44269e-114, 3.39683e-182, 4.29978e-265},
{-0.806291, 0.000115283, 1.88834e-25, 2.91769e-62, 1.47537e-114, 3.45753e-182, 4.36324e-265},
{-0.806291, 0.00013386, 2.00433e-25, 3.03048e-62, 1.51711e-114, 3.53475e-182, 4.44375e-265},
{-0.806291, 0.000156898, 2.13719e-25, 3.15761e-62, 1.56387e-114, 3.62099e-182, 4.53353e-265},
{-0.806291, 0.000180277, 2.2713e-25, 3.28557e-62, 1.61087e-114, 3.70758e-182, 4.6236e-265},
{-0.806291, 0.000199744, 2.39057e-25, 3.40054e-62, 1.65322e-114, 3.7857e-182, 4.7049e-265},
{-0.806291, 0.000212931, 2.48237e-25, 3.49073e-62, 1.68665e-114, 3.84752e-182, 4.76933e-265},
{-0.806291, 0.000219911, 2.53935e-25, 3.54788e-62, 1.70797e-114, 3.88706e-182, 4.81061e-265},
{-0.806291, 0.000221996, 2.55856e-25, 3.56741e-62, 1.71529e-114, 3.90066e-182, 4.82481e-265},
{-0.806291, 0.000221996, 2.55856e-25, 3.56741e-62, 1.71529e-114, 3.90066e-182, 4.82481e-265},
{-0.806291, 0.000219911, 2.53935e-25, 3.54788e-62, 1.70797e-114, 3.88706e-182, 4.81061e-265},
{-0.806291, 0.000212931, 2.48237e-25, 3.49073e-62, 1.68665e-114, 3.84752e-182, 4.76933e-265},
{-0.806291, 0.000199744, 2.39057e-25, 3.40054e-62, 1.65322e-114, 3.7857e-182, 4.7049e-265},
{-0.806291, 0.000180277, 2.2713e-25, 3.28557e-62, 1.61087e-114, 3.70758e-182, 4.6236e-265},
{-0.806291, 0.000156898, 2.13719e-25, 3.15761e-62, 1.56387e-114, 3.62099e-182, 4.53353e-265},
{-0.806291, 0.00013386, 2.00433e-25, 3.03048e-62, 1.51711e-114, 3.53475e-182, 4.44375e-265},
{-0.806291, 0.000115283, 1.88834e-25, 2.91769e-62, 1.47537e-114, 3.45753e-182, 4.36324e-265},
{-0.806291, 0.000103195, 1.8006e-25, 2.83019e-62, 1.44269e-114, 3.39683e-182, 4.29978e-265},
{-0.806291, 9.71048e-05, 1.74691e-25, 2.77522e-62, 1.42198e-114, 3.35818e-182, 4.25929e-265},
{-0.806291, 9.5359e-05, 1.72896e-25, 2.75652e-62, 1.4149e-114, 3.34493e-182, 4.24539e-265},
{-0.806291, 9.71048e-05, 1.74691e-25, 2.77522e-62, 1.42198e-114, 3.35818e-182, 4.25929e-265},
};
}
int main() {
using namespace matplot;
input0();
auto f = figure(true);
auto ax = f->current_axes();
ax->contourf(X,Y,Z);
f->draw();
//contourf(X,Y,Z);
show();
return 0;
}
Building:
g++ -g -o out prog.cpp -lmatplot && ./out
Output
Segmentation fault (core dumped)
GNU gdb (Ubuntu 12.1-3ubuntu2) 12.1 output
gdb out
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[Detaching after vfork from child process 11148]
[Detaching after vfork from child process 11150]
[Detaching after vfork from child process 11151]
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff75b33d1 in matplot::contours::is_lower_level(unsigned long, unsigned long, unsigned long) () from /usr/local/lib/libmatplot.so
(gdb) backtrace
#0 0x00007ffff75b33d1 in matplot::contours::is_lower_level(unsigned long, unsigned long, unsigned long) () from /usr/local/lib/libmatplot.so
#1 0x00007ffff75bee45 in matplot::contours::plot_string[abi:cxx11]() () from /usr/local/lib/libmatplot.so
#2 0x00007ffff74ade2f in matplot::axes_type::run_plot_objects_command() () from /usr/local/lib/libmatplot.so
#3 0x00007ffff74e4c59 in matplot::figure_type::send_gnuplot_draw_commands() () from /usr/local/lib/libmatplot.so
#4 0x00007ffff74e5315 in matplot::figure_type::draw() () from /usr/local/lib/libmatplot.so
#5 0x0000555555557b18 in main () at prog.cpp:14
(gdb)
valgrind output (if that's of any help):
valgrind --leak-check=full --show-leak-kinds=all -s ./out
Output: https://pastebin.com/TeQxuWv0
Platform
- cross-platform issue - linux
- cross-platform issue - windows
- cross-platform issue - macos
Environment Details:
- OS: Ubuntu (Ubuntu 22.10, Gnome 43.1, windowing system X11)
- OS Version: 22.10
- Compiler: g++
- Compiler version: g++ (Ubuntu 12.2.0-3ubuntu1) 12.2.0