3
$\begingroup$

This question already has an answer here:

In DensityPlot, how to get rid of the white margin between the figure and the frame so that the figure itself spans the entire domain?

DensityPlot[Sin[x y], {x, -1, 1}, {y, -1, 1}, 
  Frame -> True, 
  ImagePadding -> {{20, 20}, {20, 20}}, 
  ImageSize -> {Automatic, 300}]

sin(xy)

$\endgroup$

marked as duplicate by Jens, ciao, Yves Klett, Simon Woods, Mike Honeychurch May 23 '14 at 9:03

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 3
    $\begingroup$ PlotRangePadding -> 0 $\endgroup$ – Kuba May 23 '14 at 4:32
  • $\begingroup$ It should be noted that specifying non-negative values for PlotRangePadding does not reduce the domain of a plot. It extends the domain so as to include the requested padding. You will see no more of your plot by setting PlotRangePadding to zero or None. You will just make the ticks harder to see. $\endgroup$ – m_goldberg May 23 '14 at 5:18
  • $\begingroup$ @m_goldberg On that note, I became curious about following: Is it possible to reverse the ticks so they point outward? $\endgroup$ – joojaa May 23 '14 at 5:46
  • $\begingroup$ @joojaa yes. look up Ticks in the docs. $\endgroup$ – Mike Honeychurch May 23 '14 at 6:08
  • $\begingroup$ @MikeHoneychurch could you vote as a duplicate of: 18807. I've lost my vote, which is retracted now, for "simple mistake". $\endgroup$ – Kuba May 23 '14 at 6:45
6
$\begingroup$

Try this:

    DensityPlot[Sin[x y], {x, -1, 1}, {y, -1, 1}, Frame -> True, 
 ImagePadding -> {{20, 20}, {20, 20}}, ImageSize -> {Automatic, 300}, 
 PlotRangePadding -> 0]

enter image description here

$\endgroup$

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