2
Plot[2x, {x,0,4}]
Plot[x^2, {x,10,12}]

How do I merge these two graphs into one graph without the range {4,10}?

rhermans
  • 36,518
  • 4
  • 57
  • 149
hvphuc
  • 21
  • 1
  • 1
  • 2

1 Answers1

3

Depending on your needs.

Show[
 Plot[2 x, {x, 0, 4}],
  Plot[x^2, {x, 0, 12}]
 ]

OR

  Plot[{2 x, x^2}, {x, 0, 4}]
rhermans
  • 36,518
  • 4
  • 57
  • 149
  • 1
    If my reading of the question is correct, the OP doesn't want the parts in the interval $(4,10)$ to show up. – J. M.'s missing motivation Oct 14 '15 at 17:36
  • 1
    @J.M.isback. corrected, thanks – rhermans Oct 14 '15 at 17:37
  • @J.M.isback.: Yes, how can I do that? Thanks. – hvphuc Oct 14 '15 at 17:41
  • @hvphuc, did you already look up the thing I suggested in my first comment? – J. M.'s missing motivation Oct 14 '15 at 17:44
  • @J.M.isback. Thank you for your answer, I have read the thing you suggested. But it doesn't solve my problem. – hvphuc Oct 15 '15 at 10:57
  • @hvphuc, so Show[Plot[2 x, {x, 0, 4}], Plot[x^2, {x, 10, 12}], PlotRange -> {{0, 12}, Automatic}] is not what you want? – J. M.'s missing motivation Oct 15 '15 at 11:01
  • @J.M.isback. No, I want the parts in the interval (0,4) and (10,12), the range (4,10) not to show up in the picture. Could you help me to solve it? – hvphuc Oct 15 '15 at 11:17
  • 1
    @hvphuc In two separate plots? same plot with broken axes? Is there an example you can point? We are willing to help, but you don't explain thoroughly what your needs are. You need to help us to help you. You should have explained properly on the first instance on your original question. – rhermans Oct 15 '15 at 11:24
  • I am so sorry @rhermans, my question is not clear. I want to plot two functions in the same figure with the broken x-axes. I understand that all you try to help us. I am sorry for this inconvenience. – hvphuc Oct 15 '15 at 11:30
  • @hvphuc Something like this but in the horizontal axis? http://mathematica.stackexchange.com/a/35207/10397 – rhermans Oct 15 '15 at 11:33
  • @rhermans. Thanks for the answers, although not in the x-axis, it is useful. But I hoped there where someway around it, and I think I will go for it. Thanks for the help. – hvphuc Oct 15 '15 at 11:46