1
$\begingroup$

does anyone know how I can display this plot?

LogLogPlot[
 Piecewise[
  {
   {10^19 Exp[-10^12 t], 10^-19 <= t <= 10^-11 },
   {10^15 Exp[-10^9 t], 10^-11 <= t <= 10^-8},
   {10^11 t^(-1/2), 10^-8 <= t <= 10^36}
   }
  ],
 {t, 10^-19, 10^36},
 PlotRange -> {10^-13, 10^19}, 
 Epilog -> {Line[{10^-8, 10^15}, {10^-8, 10^-13}]}]

Trying to display it mathematica seems to give up somewhere on the second piecewise function, and the vertical line displays in a different position? Thanks!

PS Could someone explain why/how plots or graphics choose their coordinates, and how epilog chooses theirs? I figured out they don't seem to match, in particular for using LogLogPlot. many thanks!

$\endgroup$

closed as off-topic by MarcoB, corey979, rhermans, JungHwan Min, Henrik Schumacher Jul 19 '18 at 23:04

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – MarcoB, corey979, rhermans, JungHwan Min, Henrik Schumacher
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 2
    $\begingroup$ You are missing a set of curly braces in your Line. It should be Epilog -> {Line[{{10^-8, 10^15}, {10^-8, 10^-13}}]}. This has nothing to do with machine precision $\endgroup$ – MarcoB Jul 18 '18 at 15:36
  • $\begingroup$ Silly me thanks @MarcoB $\endgroup$ – MKF Jul 18 '18 at 15:37
  • $\begingroup$ No problem. Glad it was an easy fix. $\endgroup$ – MarcoB Jul 18 '18 at 15:37
  • $\begingroup$ The line for some reason doesn't plot at 10^-8 with the curly braces; any idea why maybe? $\endgroup$ – MKF Jul 18 '18 at 15:39
  • 1
    $\begingroup$ Actually I figured it out, because the logplot uses different coordinates to Epilog, thanks! $\endgroup$ – MKF Jul 18 '18 at 15:45
3
$\begingroup$

The Log plots log-transform the data (x, y or both, depending on the plot you choose – both for LogLogPlot) and change the tick labels to indicate the original (linear) scale. The whole plotting happens after transformation of the coordinates:

LogLogPlot effectively generates a curve in which Log[f] is plotted against Log[x], but with tick marks indicating the original values of f and x.

As a result, you have to log-transform the coordinates in Epilog because Epilog is rendered after the original plot. Here the original plot without the Epilog:

loglogplot := 
  LogLogPlot[
   Piecewise[{{10^19 Exp[-10^12 t], 
      10^-19 <= t <= 10^-11}, {10^15 Exp[-10^9 t], 
      10^-11 <= t <= 10^-8}, {10^11 t^(-1/2), 
      10^-8 <= t <= 10^36}}], {t, 10^-19, 10^36}, 
   PlotRange -> {10^-13, 10^19}];

Now add the Epilog with the log-transformed coordinates:

Show[
 loglogplot,
 Epilog -> {Line[Log@{{10^-8, 10^15}, {10^-8, 10^-13}}]}
 ]

LogLogPlot with Epilog

Showing the plot with another Graphics object gives the same result:

Show[
 loglogplot,
 Graphics[{Line[Log@{{10^-8, 10^15}, {10^-8, 10^-13}}]}]
 ]

(* same plot as above *)

Note how Log, being Listable, automatically threads over all coordinates within Line.

$\endgroup$

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