3
$\begingroup$

Is there any way to remove white space from Density plot?(See below). I tried "MaxPlotPoints", but it doesn't work in my case.

enter image description here

I used the command below for this plot:

  plot = 
  ListDensityPlot[tablogdiffxsec, 
  PlotLegends -> 
   BarLegend[Automatic, 
   LabelStyle -> {FontWeight -> Bold, FontSize -> 11}],
  BaseStyle -> {FontWeight -> Bold, FontSize -> 13}, 
  ColorFunction -> ColorData["CMYKColors"]]

The data "tablogdiffxsec" I used in this link: enter link description here

Thanks!

$\endgroup$
5
  • 2
    $\begingroup$ Try PlotRange->All but that'll also mess up your scaling $\endgroup$
    – b3m2a1
    Mar 18 '20 at 22:25
  • $\begingroup$ Thanks! I tried it, but it didn't work. $\endgroup$
    – Ghady
    Mar 19 '20 at 1:56
  • $\begingroup$ Do you know have data in that region, then? $\endgroup$
    – b3m2a1
    Mar 19 '20 at 2:10
  • $\begingroup$ @Ghady it's convenient if you upload sample data via google drive or one drive link $\endgroup$
    – Rupesh
    Mar 19 '20 at 3:17
  • $\begingroup$ I added the data using the link. Please, see the question. $\endgroup$
    – Ghady
    Mar 20 '20 at 2:28
1
$\begingroup$

You can set the option ClippingStyle -> Automatic, in which case the region that was clipped by PlotRange -> Automatic will be filled in with the surrounding color, ie. blue.

Note that this means the legend isn't completely accurate then, since it doesn't have a good way of indicating that the bottom blue color is really an extended range of values.

In V12.2 on my system, I get a different choice for the automatic plot range calculation, resulting in a smaller area that got clipped:

enter image description here

Here's an example where I've approximated the plot range shown in your screenshots:

enter image description here

$\endgroup$
0
$\begingroup$

Well I looked into your Data and I get nothing strange to what data points are:

data=tablogdiffxsec;
plot = ListDensityPlot[data, PlotRange -> All, 
       PlotLegends -> BarLegend[Automatic, 
       LabelStyle -> {FontWeight -> Bold, FontSize -> 11}],  BaseStyle -> {FontWeight -> Bold, FontSize -> 13}, 
       ColorFunction -> ColorData["CMYKColors"]]

enter image description here

Lets, Just select some points within the small reddish region:

Select[data, First[data][[1]] < #[[1]] < 1.15 && 0 < #[[2]] < 50 &][[1 ;; 10]]
(*{{1.1437, 0.18, -13.466}, {1.1437, 0.36, -13.4667}, {1.1437, 
  0.54, -13.4678}, {1.1437, 0.72, -13.4694}, {1.1437, 
  0.9, -13.4714}, {1.1437, 1.08, -13.4739}, {1.1437, 
  1.26, -13.4769}, {1.1437, 1.44, -13.4803}, {1.1437, 
  1.62, -13.4842}, {1.1437, 1.8, -13.4885}}*)

and, yellow/blackish region,

Select[data, 1.18 < #[[1]] < 1.20 && 0 < #[[2]] < 50 &][[1 ;; 10]]
(*{{1.185, 0.18, -3.16836}, {1.185, 0.36, -3.16845}, {1.185, 
0.54, -3.16861}, {1.185, 0.72, -3.16882}, {1.185, 
0.9, -3.16909}, {1.185, 1.08, -3.16943}, {1.185, 
1.26, -3.16983}, {1.185, 1.44, -3.17028}, {1.185, 
1.62, -3.1708}, {1.185, 1.8, -3.17138}}*)

Plot is conistant with the points.

Update:

enter image description here

$\endgroup$
3
  • $\begingroup$ Thanks. Actually, this is what I obtained when I used PlotRange->All. In my case,I have to show the blue region, so this is not the way I am looking for.Do you think there is a way to remove white space without reducing the blue region? $\endgroup$
    – Ghady
    Mar 20 '20 at 18:31
  • $\begingroup$ Can you plot Select[data, First[data][[1]] < #[[1]] < 1.147 && 0 < #[[2]] < 50 &] ? . It's a cropped data focused around the blue region or you can crop more. I don't know if you have enough data points for it though $\endgroup$
    – Rupesh
    Mar 20 '20 at 18:46
  • $\begingroup$ I appreciate your effort, but I have to explain the behavior for the entire region considering the minimum which is blue region. $\endgroup$
    – Ghady
    Mar 21 '20 at 20:50

Not the answer you're looking for? Browse other questions tagged or ask your own question.