Cannot overlay, because ListPlot does not draw same X range despite the same PlotRangePlot does not plot over the specified rangeThe same range on each plot in a gridListPlot filling not appearing when point is out of rangeListPlot does not recognize my listListPolarPlot not showing full plot range even with PlotRange -> AllPlot does not take range with OptionValue and PlotRange optionHow to overlay ListPlot on a ContourPlot with correct range?PlotRange -> Automatic/All/Full does not adjust the z-axisArrayPlot does not draw unit diskWhy are these plots not the same?

Compressed gas thruster for an orbital launch vehicle?

What are the consequences for a developed nation to not accept any refugees?

Users forgetting to regenerate PDF before sending it

How to convert diagonal matrix to rectangular matrix

Why AI became applicable only after Nvidia's chips were available?

Are all diatonic chords in the diminished scale diminished?

Would a Nikon FG 20 film SLR camera take pictures without batteries?

Why did Old English lose both thorn and eth?

Adjust the Table

What could cause the sea level to massively decrease?

Why does the Antonov AN-225 not have any winglets?

Is there a strong legal guarantee that the U.S. can give to another country that it won't attack them?

What minifigure is this?

What does collachrimation mean?

What exactly is a "murder hobo"?

How do you move up one folder in Finder?

Distinguish the explanations of Galadriel's test in LotR

Why different specifications for telescopes and binoculars?

Swapping "Good" and "Bad"

Bold and Colored Image Caption

How to properly translate the key phrase of Erdoğan's 2016 letter to Putin, "kusura bakmasınlar," to Russian

What was this character's plan?

Party going through airport security at separate times?

Publishing papers seem natural to many, while I find it really hard to think novel stuff to pursue till publication. How to cope up with this?



Cannot overlay, because ListPlot does not draw same X range despite the same PlotRange


Plot does not plot over the specified rangeThe same range on each plot in a gridListPlot filling not appearing when point is out of rangeListPlot does not recognize my listListPolarPlot not showing full plot range even with PlotRange -> AllPlot does not take range with OptionValue and PlotRange optionHow to overlay ListPlot on a ContourPlot with correct range?PlotRange -> Automatic/All/Full does not adjust the z-axisArrayPlot does not draw unit diskWhy are these plots not the same?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








7












$begingroup$


curveData = Import["D:\Curve.txt", "Table", "FieldSeparators" -> " "]
lineData = Import["D:\Line.txt", "Table", "FieldSeparators" -> " "]
curvePlot = ListPlot[curveData, PlotRange -> 200, 600, All, AxesOrigin -> 200, 0, Frame -> True, True, True, False]
linePlot = ListPlot[lineData, PlotRange -> 200, 600, All, PlotStyle -> PointSize[0], AxesOrigin -> 200, 0, Frame -> False, False, False, True, Filling -> Axis, FillingStyle -> Thickness[Tiny]]
Overlay[curvePlot, linePlot]


I am trying to overlay two plots. However, overlay does not produce aligned plots. The reason seems to be that the plots don't have the same absolute X range, despite the same PlotRange. Could you help to comment the reason ? Many thanks !



Curve.txt



Lines.txt



curveData, lineData = Import["https://pastebin.com/raw/SEg5tThi", "RawJSON"];


Cannot overlay










share|improve this question











$endgroup$







  • 1




    $begingroup$
    Try Show instead of Overlay
    $endgroup$
    – Ulrich Neumann
    Jun 30 at 11:33










  • $begingroup$
    @UlrichNeumann Could you help to suggest more specifically how to use show in this circumstance ? Many thanks !
    $endgroup$
    – SOUser
    Jun 30 at 12:26

















7












$begingroup$


curveData = Import["D:\Curve.txt", "Table", "FieldSeparators" -> " "]
lineData = Import["D:\Line.txt", "Table", "FieldSeparators" -> " "]
curvePlot = ListPlot[curveData, PlotRange -> 200, 600, All, AxesOrigin -> 200, 0, Frame -> True, True, True, False]
linePlot = ListPlot[lineData, PlotRange -> 200, 600, All, PlotStyle -> PointSize[0], AxesOrigin -> 200, 0, Frame -> False, False, False, True, Filling -> Axis, FillingStyle -> Thickness[Tiny]]
Overlay[curvePlot, linePlot]


I am trying to overlay two plots. However, overlay does not produce aligned plots. The reason seems to be that the plots don't have the same absolute X range, despite the same PlotRange. Could you help to comment the reason ? Many thanks !



Curve.txt



Lines.txt



curveData, lineData = Import["https://pastebin.com/raw/SEg5tThi", "RawJSON"];


Cannot overlay










share|improve this question











$endgroup$







  • 1




    $begingroup$
    Try Show instead of Overlay
    $endgroup$
    – Ulrich Neumann
    Jun 30 at 11:33










  • $begingroup$
    @UlrichNeumann Could you help to suggest more specifically how to use show in this circumstance ? Many thanks !
    $endgroup$
    – SOUser
    Jun 30 at 12:26













7












7








7


1



$begingroup$


curveData = Import["D:\Curve.txt", "Table", "FieldSeparators" -> " "]
lineData = Import["D:\Line.txt", "Table", "FieldSeparators" -> " "]
curvePlot = ListPlot[curveData, PlotRange -> 200, 600, All, AxesOrigin -> 200, 0, Frame -> True, True, True, False]
linePlot = ListPlot[lineData, PlotRange -> 200, 600, All, PlotStyle -> PointSize[0], AxesOrigin -> 200, 0, Frame -> False, False, False, True, Filling -> Axis, FillingStyle -> Thickness[Tiny]]
Overlay[curvePlot, linePlot]


I am trying to overlay two plots. However, overlay does not produce aligned plots. The reason seems to be that the plots don't have the same absolute X range, despite the same PlotRange. Could you help to comment the reason ? Many thanks !



Curve.txt



Lines.txt



curveData, lineData = Import["https://pastebin.com/raw/SEg5tThi", "RawJSON"];


Cannot overlay










share|improve this question











$endgroup$




curveData = Import["D:\Curve.txt", "Table", "FieldSeparators" -> " "]
lineData = Import["D:\Line.txt", "Table", "FieldSeparators" -> " "]
curvePlot = ListPlot[curveData, PlotRange -> 200, 600, All, AxesOrigin -> 200, 0, Frame -> True, True, True, False]
linePlot = ListPlot[lineData, PlotRange -> 200, 600, All, PlotStyle -> PointSize[0], AxesOrigin -> 200, 0, Frame -> False, False, False, True, Filling -> Axis, FillingStyle -> Thickness[Tiny]]
Overlay[curvePlot, linePlot]


I am trying to overlay two plots. However, overlay does not produce aligned plots. The reason seems to be that the plots don't have the same absolute X range, despite the same PlotRange. Could you help to comment the reason ? Many thanks !



Curve.txt



Lines.txt



curveData, lineData = Import["https://pastebin.com/raw/SEg5tThi", "RawJSON"];


Cannot overlay







plotting graphics scaling






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jun 30 at 13:15









rhermans

22.4k4 gold badges41 silver badges107 bronze badges




22.4k4 gold badges41 silver badges107 bronze badges










asked Jun 30 at 11:15









SOUserSOUser

1433 bronze badges




1433 bronze badges







  • 1




    $begingroup$
    Try Show instead of Overlay
    $endgroup$
    – Ulrich Neumann
    Jun 30 at 11:33










  • $begingroup$
    @UlrichNeumann Could you help to suggest more specifically how to use show in this circumstance ? Many thanks !
    $endgroup$
    – SOUser
    Jun 30 at 12:26












  • 1




    $begingroup$
    Try Show instead of Overlay
    $endgroup$
    – Ulrich Neumann
    Jun 30 at 11:33










  • $begingroup$
    @UlrichNeumann Could you help to suggest more specifically how to use show in this circumstance ? Many thanks !
    $endgroup$
    – SOUser
    Jun 30 at 12:26







1




1




$begingroup$
Try Show instead of Overlay
$endgroup$
– Ulrich Neumann
Jun 30 at 11:33




$begingroup$
Try Show instead of Overlay
$endgroup$
– Ulrich Neumann
Jun 30 at 11:33












$begingroup$
@UlrichNeumann Could you help to suggest more specifically how to use show in this circumstance ? Many thanks !
$endgroup$
– SOUser
Jun 30 at 12:26




$begingroup$
@UlrichNeumann Could you help to suggest more specifically how to use show in this circumstance ? Many thanks !
$endgroup$
– SOUser
Jun 30 at 12:26










4 Answers
4






active

oldest

votes


















5












$begingroup$

Here's a way to combine the plots and keep the frame scales that seem intended by the OP. It would have been easier if Charting`ScaledTicks[curveScale, curveScaleInv] didn't insist that log-spaced major ticks were the way to go. One can use Charting`ScaledTicks in place of myScaledTicks in many cases.



curveData, lineData = Import["https://pastebin.com/raw/SEg5tThi", "RawJSON"];

(* creates scaling functions
* to scale data to canonical 0,1 interval and back *)
ClearAll[scalingFunctions];
scalingFunctions[data_] :=
Function /@ (Rescale[#, #2, #3], Rescale[#, #3, #2] &[#, MinMax@data, 0, 1]);
curveScale, curveScaleInv = scalingFunctions[curveData[[All, 2]]];
lineScale, lineScaleInv = scalingFunctions[lineData[[All, 2]]];

(* creates ticks corresponding to scaling functions *)
ClearAll[myScaledTicks];
myScaledTicks[sf_, isf_][min_, max_, n_: 6, 6] :=
Module[major, minor,
major, minor = FindDivisions[isf@min, max, n] /. x_Rational :> N[x];
minor = Complement[Join @@ minor, major];
major =
sf[#], #,
0.01, 0.,
AbsoluteThickness[0.1]
& /@ major;
minor =
sf[#], Spacer[0, 0],
0.005, 0.,
AbsoluteThickness[0.1]
& /@ minor;
Join[major, minor]
];


Plot of OP's data:



Show[
curvePlot = ListPlot[curveData, PlotRange -> 200, 600, All,
AxesOrigin -> 200, 0, Frame -> True,
ScalingFunctions -> curveScale, curveScaleInv],
linePlot = ListPlot[lineData,
PlotRange -> 200, 600, All, PlotStyle -> PointSize[0],
AxesOrigin -> 200, 0, Filling -> Axis,
FillingStyle -> Thickness[Tiny],
ScalingFunctions -> lineScale, lineScaleInv],
FrameTicks ->
myScaledTicks[curveScale, curveScaleInv],
myScaledTicks[lineScale, lineScaleInv],
Automatic, Automatic,
FrameLabel -> "curve (units?)", "line (units?)", "x (units?)", None
]


enter image description here






share|improve this answer









$endgroup$












  • $begingroup$
    Thank you for your knowledgeable help !
    $endgroup$
    – SOUser
    Jul 1 at 1:41










  • $begingroup$
    @SOUser You're welcome!
    $endgroup$
    – Michael E2
    Jul 1 at 3:26


















5












$begingroup$

curveData, lineData = Import["https://pastebin.com/raw/SEg5tThi", "RawJSON"];


curvePlot = ListPlot[
curveData
, PlotRange -> 200, 600, All
, AxesOrigin -> 200, 0
, Frame -> True, True, True, False
];
linePlot = ListPlot[
lineData.DiagonalMatrix[1, 40000]
, PlotRange -> 200, 600, All
, PlotStyle -> PointSize[0]
, AxesOrigin -> 200, 0
, Frame -> False, False, False, True
, Filling -> Axis
, FillingStyle -> Thickness[Tiny]
];

Show[curvePlot, linePlot]


Mathematica graphics






share|improve this answer











$endgroup$




















    4












    $begingroup$

    Try



    Show[curvePlot, linePlot]


    enter image description here



    As you can see the scaling of your data should be adapted!






    share|improve this answer









    $endgroup$




















      3












      $begingroup$

      If you want a more automated version of @MiachelE2's answer, you can use the CombinePlots function of the ForScience` paclet (see below for instructions on how to install it) with the setting "AxesSides" -> "TwoY" (see the documentation of the paclet for more details and examples):



      <<ForScience`

      curveData, lineData = Import["https://pastebin.com/raw/SEg5tThi", "RawJSON"];

      curvePlot = ListPlot[
      curveData,
      PlotRange -> 200, 600, All,
      AxesOrigin -> 200, 0,
      Frame -> True,
      FrameLabel -> "x axis", "curve (units?)"
      ]
      linePlot = ListPlot[
      lineData,
      PlotRange -> 200, 600, All,
      PlotStyle -> PointSize[0], Red,
      AxesOrigin -> 200, 0,
      Filling -> Axis,
      FillingStyle -> Thickness[Tiny],
      Frame -> True,
      FrameLabel -> "x axis", "line (units?)",
      FrameStyle -> Red
      ]


      enter image description here



      CombinePlots[curvePlot, linePlot, "AxesSides" -> "TwoY"]


      enter image description here



      Note how the FrameLabel,FrameTicks and FrameStyle of the second plot were automatically moved to the right side



      How to install the paclet



      The current version (0.88.45) of the paclet can be installed by running



      PacletInstall[
      "https://github.com/MMA-ForScience/ForScience/releases/download/v0.88.45/ForScience-0.88.45.paclet"
      ]





      share|improve this answer











      $endgroup$















        Your Answer








        StackExchange.ready(function()
        var channelOptions =
        tags: "".split(" "),
        id: "387"
        ;
        initTagRenderer("".split(" "), "".split(" "), channelOptions);

        StackExchange.using("externalEditor", function()
        // Have to fire editor after snippets, if snippets enabled
        if (StackExchange.settings.snippets.snippetsEnabled)
        StackExchange.using("snippets", function()
        createEditor();
        );

        else
        createEditor();

        );

        function createEditor()
        StackExchange.prepareEditor(
        heartbeatType: 'answer',
        autoActivateHeartbeat: false,
        convertImagesToLinks: false,
        noModals: true,
        showLowRepImageUploadWarning: true,
        reputationToPostImages: null,
        bindNavPrevention: true,
        postfix: "",
        imageUploader:
        brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
        contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
        allowUrls: true
        ,
        onDemand: true,
        discardSelector: ".discard-answer"
        ,immediatelyShowMarkdownHelp:true
        );



        );













        draft saved

        draft discarded


















        StackExchange.ready(
        function ()
        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f201265%2fcannot-overlay-because-listplot-does-not-draw-same-x-range-despite-the-same-plo%23new-answer', 'question_page');

        );

        Post as a guest















        Required, but never shown

























        4 Answers
        4






        active

        oldest

        votes








        4 Answers
        4






        active

        oldest

        votes









        active

        oldest

        votes






        active

        oldest

        votes









        5












        $begingroup$

        Here's a way to combine the plots and keep the frame scales that seem intended by the OP. It would have been easier if Charting`ScaledTicks[curveScale, curveScaleInv] didn't insist that log-spaced major ticks were the way to go. One can use Charting`ScaledTicks in place of myScaledTicks in many cases.



        curveData, lineData = Import["https://pastebin.com/raw/SEg5tThi", "RawJSON"];

        (* creates scaling functions
        * to scale data to canonical 0,1 interval and back *)
        ClearAll[scalingFunctions];
        scalingFunctions[data_] :=
        Function /@ (Rescale[#, #2, #3], Rescale[#, #3, #2] &[#, MinMax@data, 0, 1]);
        curveScale, curveScaleInv = scalingFunctions[curveData[[All, 2]]];
        lineScale, lineScaleInv = scalingFunctions[lineData[[All, 2]]];

        (* creates ticks corresponding to scaling functions *)
        ClearAll[myScaledTicks];
        myScaledTicks[sf_, isf_][min_, max_, n_: 6, 6] :=
        Module[major, minor,
        major, minor = FindDivisions[isf@min, max, n] /. x_Rational :> N[x];
        minor = Complement[Join @@ minor, major];
        major =
        sf[#], #,
        0.01, 0.,
        AbsoluteThickness[0.1]
        & /@ major;
        minor =
        sf[#], Spacer[0, 0],
        0.005, 0.,
        AbsoluteThickness[0.1]
        & /@ minor;
        Join[major, minor]
        ];


        Plot of OP's data:



        Show[
        curvePlot = ListPlot[curveData, PlotRange -> 200, 600, All,
        AxesOrigin -> 200, 0, Frame -> True,
        ScalingFunctions -> curveScale, curveScaleInv],
        linePlot = ListPlot[lineData,
        PlotRange -> 200, 600, All, PlotStyle -> PointSize[0],
        AxesOrigin -> 200, 0, Filling -> Axis,
        FillingStyle -> Thickness[Tiny],
        ScalingFunctions -> lineScale, lineScaleInv],
        FrameTicks ->
        myScaledTicks[curveScale, curveScaleInv],
        myScaledTicks[lineScale, lineScaleInv],
        Automatic, Automatic,
        FrameLabel -> "curve (units?)", "line (units?)", "x (units?)", None
        ]


        enter image description here






        share|improve this answer









        $endgroup$












        • $begingroup$
          Thank you for your knowledgeable help !
          $endgroup$
          – SOUser
          Jul 1 at 1:41










        • $begingroup$
          @SOUser You're welcome!
          $endgroup$
          – Michael E2
          Jul 1 at 3:26















        5












        $begingroup$

        Here's a way to combine the plots and keep the frame scales that seem intended by the OP. It would have been easier if Charting`ScaledTicks[curveScale, curveScaleInv] didn't insist that log-spaced major ticks were the way to go. One can use Charting`ScaledTicks in place of myScaledTicks in many cases.



        curveData, lineData = Import["https://pastebin.com/raw/SEg5tThi", "RawJSON"];

        (* creates scaling functions
        * to scale data to canonical 0,1 interval and back *)
        ClearAll[scalingFunctions];
        scalingFunctions[data_] :=
        Function /@ (Rescale[#, #2, #3], Rescale[#, #3, #2] &[#, MinMax@data, 0, 1]);
        curveScale, curveScaleInv = scalingFunctions[curveData[[All, 2]]];
        lineScale, lineScaleInv = scalingFunctions[lineData[[All, 2]]];

        (* creates ticks corresponding to scaling functions *)
        ClearAll[myScaledTicks];
        myScaledTicks[sf_, isf_][min_, max_, n_: 6, 6] :=
        Module[major, minor,
        major, minor = FindDivisions[isf@min, max, n] /. x_Rational :> N[x];
        minor = Complement[Join @@ minor, major];
        major =
        sf[#], #,
        0.01, 0.,
        AbsoluteThickness[0.1]
        & /@ major;
        minor =
        sf[#], Spacer[0, 0],
        0.005, 0.,
        AbsoluteThickness[0.1]
        & /@ minor;
        Join[major, minor]
        ];


        Plot of OP's data:



        Show[
        curvePlot = ListPlot[curveData, PlotRange -> 200, 600, All,
        AxesOrigin -> 200, 0, Frame -> True,
        ScalingFunctions -> curveScale, curveScaleInv],
        linePlot = ListPlot[lineData,
        PlotRange -> 200, 600, All, PlotStyle -> PointSize[0],
        AxesOrigin -> 200, 0, Filling -> Axis,
        FillingStyle -> Thickness[Tiny],
        ScalingFunctions -> lineScale, lineScaleInv],
        FrameTicks ->
        myScaledTicks[curveScale, curveScaleInv],
        myScaledTicks[lineScale, lineScaleInv],
        Automatic, Automatic,
        FrameLabel -> "curve (units?)", "line (units?)", "x (units?)", None
        ]


        enter image description here






        share|improve this answer









        $endgroup$












        • $begingroup$
          Thank you for your knowledgeable help !
          $endgroup$
          – SOUser
          Jul 1 at 1:41










        • $begingroup$
          @SOUser You're welcome!
          $endgroup$
          – Michael E2
          Jul 1 at 3:26













        5












        5








        5





        $begingroup$

        Here's a way to combine the plots and keep the frame scales that seem intended by the OP. It would have been easier if Charting`ScaledTicks[curveScale, curveScaleInv] didn't insist that log-spaced major ticks were the way to go. One can use Charting`ScaledTicks in place of myScaledTicks in many cases.



        curveData, lineData = Import["https://pastebin.com/raw/SEg5tThi", "RawJSON"];

        (* creates scaling functions
        * to scale data to canonical 0,1 interval and back *)
        ClearAll[scalingFunctions];
        scalingFunctions[data_] :=
        Function /@ (Rescale[#, #2, #3], Rescale[#, #3, #2] &[#, MinMax@data, 0, 1]);
        curveScale, curveScaleInv = scalingFunctions[curveData[[All, 2]]];
        lineScale, lineScaleInv = scalingFunctions[lineData[[All, 2]]];

        (* creates ticks corresponding to scaling functions *)
        ClearAll[myScaledTicks];
        myScaledTicks[sf_, isf_][min_, max_, n_: 6, 6] :=
        Module[major, minor,
        major, minor = FindDivisions[isf@min, max, n] /. x_Rational :> N[x];
        minor = Complement[Join @@ minor, major];
        major =
        sf[#], #,
        0.01, 0.,
        AbsoluteThickness[0.1]
        & /@ major;
        minor =
        sf[#], Spacer[0, 0],
        0.005, 0.,
        AbsoluteThickness[0.1]
        & /@ minor;
        Join[major, minor]
        ];


        Plot of OP's data:



        Show[
        curvePlot = ListPlot[curveData, PlotRange -> 200, 600, All,
        AxesOrigin -> 200, 0, Frame -> True,
        ScalingFunctions -> curveScale, curveScaleInv],
        linePlot = ListPlot[lineData,
        PlotRange -> 200, 600, All, PlotStyle -> PointSize[0],
        AxesOrigin -> 200, 0, Filling -> Axis,
        FillingStyle -> Thickness[Tiny],
        ScalingFunctions -> lineScale, lineScaleInv],
        FrameTicks ->
        myScaledTicks[curveScale, curveScaleInv],
        myScaledTicks[lineScale, lineScaleInv],
        Automatic, Automatic,
        FrameLabel -> "curve (units?)", "line (units?)", "x (units?)", None
        ]


        enter image description here






        share|improve this answer









        $endgroup$



        Here's a way to combine the plots and keep the frame scales that seem intended by the OP. It would have been easier if Charting`ScaledTicks[curveScale, curveScaleInv] didn't insist that log-spaced major ticks were the way to go. One can use Charting`ScaledTicks in place of myScaledTicks in many cases.



        curveData, lineData = Import["https://pastebin.com/raw/SEg5tThi", "RawJSON"];

        (* creates scaling functions
        * to scale data to canonical 0,1 interval and back *)
        ClearAll[scalingFunctions];
        scalingFunctions[data_] :=
        Function /@ (Rescale[#, #2, #3], Rescale[#, #3, #2] &[#, MinMax@data, 0, 1]);
        curveScale, curveScaleInv = scalingFunctions[curveData[[All, 2]]];
        lineScale, lineScaleInv = scalingFunctions[lineData[[All, 2]]];

        (* creates ticks corresponding to scaling functions *)
        ClearAll[myScaledTicks];
        myScaledTicks[sf_, isf_][min_, max_, n_: 6, 6] :=
        Module[major, minor,
        major, minor = FindDivisions[isf@min, max, n] /. x_Rational :> N[x];
        minor = Complement[Join @@ minor, major];
        major =
        sf[#], #,
        0.01, 0.,
        AbsoluteThickness[0.1]
        & /@ major;
        minor =
        sf[#], Spacer[0, 0],
        0.005, 0.,
        AbsoluteThickness[0.1]
        & /@ minor;
        Join[major, minor]
        ];


        Plot of OP's data:



        Show[
        curvePlot = ListPlot[curveData, PlotRange -> 200, 600, All,
        AxesOrigin -> 200, 0, Frame -> True,
        ScalingFunctions -> curveScale, curveScaleInv],
        linePlot = ListPlot[lineData,
        PlotRange -> 200, 600, All, PlotStyle -> PointSize[0],
        AxesOrigin -> 200, 0, Filling -> Axis,
        FillingStyle -> Thickness[Tiny],
        ScalingFunctions -> lineScale, lineScaleInv],
        FrameTicks ->
        myScaledTicks[curveScale, curveScaleInv],
        myScaledTicks[lineScale, lineScaleInv],
        Automatic, Automatic,
        FrameLabel -> "curve (units?)", "line (units?)", "x (units?)", None
        ]


        enter image description here







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Jun 30 at 18:16









        Michael E2Michael E2

        155k12 gold badges213 silver badges502 bronze badges




        155k12 gold badges213 silver badges502 bronze badges











        • $begingroup$
          Thank you for your knowledgeable help !
          $endgroup$
          – SOUser
          Jul 1 at 1:41










        • $begingroup$
          @SOUser You're welcome!
          $endgroup$
          – Michael E2
          Jul 1 at 3:26
















        • $begingroup$
          Thank you for your knowledgeable help !
          $endgroup$
          – SOUser
          Jul 1 at 1:41










        • $begingroup$
          @SOUser You're welcome!
          $endgroup$
          – Michael E2
          Jul 1 at 3:26















        $begingroup$
        Thank you for your knowledgeable help !
        $endgroup$
        – SOUser
        Jul 1 at 1:41




        $begingroup$
        Thank you for your knowledgeable help !
        $endgroup$
        – SOUser
        Jul 1 at 1:41












        $begingroup$
        @SOUser You're welcome!
        $endgroup$
        – Michael E2
        Jul 1 at 3:26




        $begingroup$
        @SOUser You're welcome!
        $endgroup$
        – Michael E2
        Jul 1 at 3:26













        5












        $begingroup$

        curveData, lineData = Import["https://pastebin.com/raw/SEg5tThi", "RawJSON"];


        curvePlot = ListPlot[
        curveData
        , PlotRange -> 200, 600, All
        , AxesOrigin -> 200, 0
        , Frame -> True, True, True, False
        ];
        linePlot = ListPlot[
        lineData.DiagonalMatrix[1, 40000]
        , PlotRange -> 200, 600, All
        , PlotStyle -> PointSize[0]
        , AxesOrigin -> 200, 0
        , Frame -> False, False, False, True
        , Filling -> Axis
        , FillingStyle -> Thickness[Tiny]
        ];

        Show[curvePlot, linePlot]


        Mathematica graphics






        share|improve this answer











        $endgroup$

















          5












          $begingroup$

          curveData, lineData = Import["https://pastebin.com/raw/SEg5tThi", "RawJSON"];


          curvePlot = ListPlot[
          curveData
          , PlotRange -> 200, 600, All
          , AxesOrigin -> 200, 0
          , Frame -> True, True, True, False
          ];
          linePlot = ListPlot[
          lineData.DiagonalMatrix[1, 40000]
          , PlotRange -> 200, 600, All
          , PlotStyle -> PointSize[0]
          , AxesOrigin -> 200, 0
          , Frame -> False, False, False, True
          , Filling -> Axis
          , FillingStyle -> Thickness[Tiny]
          ];

          Show[curvePlot, linePlot]


          Mathematica graphics






          share|improve this answer











          $endgroup$















            5












            5








            5





            $begingroup$

            curveData, lineData = Import["https://pastebin.com/raw/SEg5tThi", "RawJSON"];


            curvePlot = ListPlot[
            curveData
            , PlotRange -> 200, 600, All
            , AxesOrigin -> 200, 0
            , Frame -> True, True, True, False
            ];
            linePlot = ListPlot[
            lineData.DiagonalMatrix[1, 40000]
            , PlotRange -> 200, 600, All
            , PlotStyle -> PointSize[0]
            , AxesOrigin -> 200, 0
            , Frame -> False, False, False, True
            , Filling -> Axis
            , FillingStyle -> Thickness[Tiny]
            ];

            Show[curvePlot, linePlot]


            Mathematica graphics






            share|improve this answer











            $endgroup$



            curveData, lineData = Import["https://pastebin.com/raw/SEg5tThi", "RawJSON"];


            curvePlot = ListPlot[
            curveData
            , PlotRange -> 200, 600, All
            , AxesOrigin -> 200, 0
            , Frame -> True, True, True, False
            ];
            linePlot = ListPlot[
            lineData.DiagonalMatrix[1, 40000]
            , PlotRange -> 200, 600, All
            , PlotStyle -> PointSize[0]
            , AxesOrigin -> 200, 0
            , Frame -> False, False, False, True
            , Filling -> Axis
            , FillingStyle -> Thickness[Tiny]
            ];

            Show[curvePlot, linePlot]


            Mathematica graphics







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Jun 30 at 13:39

























            answered Jun 30 at 13:00









            rhermansrhermans

            22.4k4 gold badges41 silver badges107 bronze badges




            22.4k4 gold badges41 silver badges107 bronze badges





















                4












                $begingroup$

                Try



                Show[curvePlot, linePlot]


                enter image description here



                As you can see the scaling of your data should be adapted!






                share|improve this answer









                $endgroup$

















                  4












                  $begingroup$

                  Try



                  Show[curvePlot, linePlot]


                  enter image description here



                  As you can see the scaling of your data should be adapted!






                  share|improve this answer









                  $endgroup$















                    4












                    4








                    4





                    $begingroup$

                    Try



                    Show[curvePlot, linePlot]


                    enter image description here



                    As you can see the scaling of your data should be adapted!






                    share|improve this answer









                    $endgroup$



                    Try



                    Show[curvePlot, linePlot]


                    enter image description here



                    As you can see the scaling of your data should be adapted!







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Jun 30 at 12:56









                    Ulrich NeumannUlrich Neumann

                    11.8k7 silver badges19 bronze badges




                    11.8k7 silver badges19 bronze badges





















                        3












                        $begingroup$

                        If you want a more automated version of @MiachelE2's answer, you can use the CombinePlots function of the ForScience` paclet (see below for instructions on how to install it) with the setting "AxesSides" -> "TwoY" (see the documentation of the paclet for more details and examples):



                        <<ForScience`

                        curveData, lineData = Import["https://pastebin.com/raw/SEg5tThi", "RawJSON"];

                        curvePlot = ListPlot[
                        curveData,
                        PlotRange -> 200, 600, All,
                        AxesOrigin -> 200, 0,
                        Frame -> True,
                        FrameLabel -> "x axis", "curve (units?)"
                        ]
                        linePlot = ListPlot[
                        lineData,
                        PlotRange -> 200, 600, All,
                        PlotStyle -> PointSize[0], Red,
                        AxesOrigin -> 200, 0,
                        Filling -> Axis,
                        FillingStyle -> Thickness[Tiny],
                        Frame -> True,
                        FrameLabel -> "x axis", "line (units?)",
                        FrameStyle -> Red
                        ]


                        enter image description here



                        CombinePlots[curvePlot, linePlot, "AxesSides" -> "TwoY"]


                        enter image description here



                        Note how the FrameLabel,FrameTicks and FrameStyle of the second plot were automatically moved to the right side



                        How to install the paclet



                        The current version (0.88.45) of the paclet can be installed by running



                        PacletInstall[
                        "https://github.com/MMA-ForScience/ForScience/releases/download/v0.88.45/ForScience-0.88.45.paclet"
                        ]





                        share|improve this answer











                        $endgroup$

















                          3












                          $begingroup$

                          If you want a more automated version of @MiachelE2's answer, you can use the CombinePlots function of the ForScience` paclet (see below for instructions on how to install it) with the setting "AxesSides" -> "TwoY" (see the documentation of the paclet for more details and examples):



                          <<ForScience`

                          curveData, lineData = Import["https://pastebin.com/raw/SEg5tThi", "RawJSON"];

                          curvePlot = ListPlot[
                          curveData,
                          PlotRange -> 200, 600, All,
                          AxesOrigin -> 200, 0,
                          Frame -> True,
                          FrameLabel -> "x axis", "curve (units?)"
                          ]
                          linePlot = ListPlot[
                          lineData,
                          PlotRange -> 200, 600, All,
                          PlotStyle -> PointSize[0], Red,
                          AxesOrigin -> 200, 0,
                          Filling -> Axis,
                          FillingStyle -> Thickness[Tiny],
                          Frame -> True,
                          FrameLabel -> "x axis", "line (units?)",
                          FrameStyle -> Red
                          ]


                          enter image description here



                          CombinePlots[curvePlot, linePlot, "AxesSides" -> "TwoY"]


                          enter image description here



                          Note how the FrameLabel,FrameTicks and FrameStyle of the second plot were automatically moved to the right side



                          How to install the paclet



                          The current version (0.88.45) of the paclet can be installed by running



                          PacletInstall[
                          "https://github.com/MMA-ForScience/ForScience/releases/download/v0.88.45/ForScience-0.88.45.paclet"
                          ]





                          share|improve this answer











                          $endgroup$















                            3












                            3








                            3





                            $begingroup$

                            If you want a more automated version of @MiachelE2's answer, you can use the CombinePlots function of the ForScience` paclet (see below for instructions on how to install it) with the setting "AxesSides" -> "TwoY" (see the documentation of the paclet for more details and examples):



                            <<ForScience`

                            curveData, lineData = Import["https://pastebin.com/raw/SEg5tThi", "RawJSON"];

                            curvePlot = ListPlot[
                            curveData,
                            PlotRange -> 200, 600, All,
                            AxesOrigin -> 200, 0,
                            Frame -> True,
                            FrameLabel -> "x axis", "curve (units?)"
                            ]
                            linePlot = ListPlot[
                            lineData,
                            PlotRange -> 200, 600, All,
                            PlotStyle -> PointSize[0], Red,
                            AxesOrigin -> 200, 0,
                            Filling -> Axis,
                            FillingStyle -> Thickness[Tiny],
                            Frame -> True,
                            FrameLabel -> "x axis", "line (units?)",
                            FrameStyle -> Red
                            ]


                            enter image description here



                            CombinePlots[curvePlot, linePlot, "AxesSides" -> "TwoY"]


                            enter image description here



                            Note how the FrameLabel,FrameTicks and FrameStyle of the second plot were automatically moved to the right side



                            How to install the paclet



                            The current version (0.88.45) of the paclet can be installed by running



                            PacletInstall[
                            "https://github.com/MMA-ForScience/ForScience/releases/download/v0.88.45/ForScience-0.88.45.paclet"
                            ]





                            share|improve this answer











                            $endgroup$



                            If you want a more automated version of @MiachelE2's answer, you can use the CombinePlots function of the ForScience` paclet (see below for instructions on how to install it) with the setting "AxesSides" -> "TwoY" (see the documentation of the paclet for more details and examples):



                            <<ForScience`

                            curveData, lineData = Import["https://pastebin.com/raw/SEg5tThi", "RawJSON"];

                            curvePlot = ListPlot[
                            curveData,
                            PlotRange -> 200, 600, All,
                            AxesOrigin -> 200, 0,
                            Frame -> True,
                            FrameLabel -> "x axis", "curve (units?)"
                            ]
                            linePlot = ListPlot[
                            lineData,
                            PlotRange -> 200, 600, All,
                            PlotStyle -> PointSize[0], Red,
                            AxesOrigin -> 200, 0,
                            Filling -> Axis,
                            FillingStyle -> Thickness[Tiny],
                            Frame -> True,
                            FrameLabel -> "x axis", "line (units?)",
                            FrameStyle -> Red
                            ]


                            enter image description here



                            CombinePlots[curvePlot, linePlot, "AxesSides" -> "TwoY"]


                            enter image description here



                            Note how the FrameLabel,FrameTicks and FrameStyle of the second plot were automatically moved to the right side



                            How to install the paclet



                            The current version (0.88.45) of the paclet can be installed by running



                            PacletInstall[
                            "https://github.com/MMA-ForScience/ForScience/releases/download/v0.88.45/ForScience-0.88.45.paclet"
                            ]






                            share|improve this answer














                            share|improve this answer



                            share|improve this answer








                            edited Jul 1 at 16:34

























                            answered Jul 1 at 11:17









                            Lukas LangLukas Lang

                            8,0141 gold badge10 silver badges32 bronze badges




                            8,0141 gold badge10 silver badges32 bronze badges



























                                draft saved

                                draft discarded
















































                                Thanks for contributing an answer to Mathematica Stack Exchange!


                                • Please be sure to answer the question. Provide details and share your research!

                                But avoid


                                • Asking for help, clarification, or responding to other answers.

                                • Making statements based on opinion; back them up with references or personal experience.

                                Use MathJax to format equations. MathJax reference.


                                To learn more, see our tips on writing great answers.




                                draft saved


                                draft discarded














                                StackExchange.ready(
                                function ()
                                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f201265%2fcannot-overlay-because-listplot-does-not-draw-same-x-range-despite-the-same-plo%23new-answer', 'question_page');

                                );

                                Post as a guest















                                Required, but never shown





















































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown

































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown







                                Popular posts from this blog

                                Get product attribute by attribute group code in magento 2get product attribute by product attribute group in magento 2Magento 2 Log Bundle Product Data in List Page?How to get all product attribute of a attribute group of Default attribute set?Magento 2.1 Create a filter in the product grid by new attributeMagento 2 : Get Product Attribute values By GroupMagento 2 How to get all existing values for one attributeMagento 2 get custom attribute of a single product inside a pluginMagento 2.3 How to get all the Multi Source Inventory (MSI) locations collection in custom module?Magento2: how to develop rest API to get new productsGet product attribute by attribute group code ( [attribute_group_code] ) in magento 2

                                Category:9 (number) SubcategoriesMedia in category "9 (number)"Navigation menuUpload mediaGND ID: 4485639-8Library of Congress authority ID: sh85091979ReasonatorScholiaStatistics

                                Magento 2.3: How do i solve this, Not registered handle, on custom form?How can i rewrite TierPrice Block in Magento2magento 2 captcha not rendering if I override layout xmlmain.CRITICAL: Plugin class doesn't existMagento 2 : Problem while adding custom button order view page?Magento 2.2.5: Overriding Admin Controller sales/orderMagento 2.2.5: Add, Update and Delete existing products Custom OptionsMagento 2.3 : File Upload issue in UI Component FormMagento2 Not registered handleHow to configured Form Builder Js in my custom magento 2.3.0 module?Magento 2.3. How to create image upload field in an admin form