Message Boards Message Boards

0
|
12549 Views
|
8 Replies
|
9 Total Likes
View groups...
Share
Share this post:
GROUPS:

Is it possible to combine two graphs into one?

Posted 9 years ago

I'd like to produce a graph comparing South African gdp per capita with the ZAR/USD exchange rate on a single graph. Is this possible, and if so, how would I do it? Or do I have to go back to R?

I have tried variations of: south africa gdp, ZAR USD exchange rate

POSTED BY: Evan Dembskey
8 Replies
Posted 9 years ago

Thanks - I really need to get a full copy of Mathematica!

POSTED BY: Evan Dembskey

Though @Sean Clarke has a good point, I would like to add, that it is sometimes used in a legitimate way, just to align two datasets, not to compare them, or to compare trends. See the figure below, which I made and published. The difference between the blue data and the black lines is given as a percentage with the green dots, on a separate scale.

enter image description here

This time I did not make the right part of the frame green (they probably won't like that at the journal), but used an arrow to indicate that you should look at the right axis.

POSTED BY: Sander Huisman
Posted 9 years ago

This is exactly the sort of thing I am looking for. Did you do this in Mathematica? I've figured out a rough and ugly way to do it in R and Julia, but I do like Alpha's look & feel a lot.

POSTED BY: Evan Dembskey

Hi Evan,

I just put custom FrameTicks on it:

rticks=Table[{10i,i},{i,1,2}]
ListPlot[Range[5]^2,Frame->True,FrameTicks->{{Automatic,rticks},{Automatic,Automatic}}]

this is a minimal example:

enter image description here

Of course you have two tweak it to fit your needs.

POSTED BY: Sander Huisman
Posted 9 years ago

Fair enough, thanks.

POSTED BY: Evan Dembskey

These kinds of graphs, time series with two different y axis values, are notoriously deceptive (example https://twitter.com/BrendanNyhan/status/649026039906238464 ). A fair number of people believe these charts just shouldn't exist, so there's some hesitation to make a package for this.

No, I don't believe you can make these with Wolfram|Alpha. You would use Mathematica or Mathematica online instead.

You can see some examples of how this is done here: http://mathematica.stackexchange.com/questions/627/1-plot-2-scale-axis

POSTED BY: Sean Clarke

Beautiful example! Thanks for sharing.

Cheers,

Marco

POSTED BY: Marco Thiel
Posted 9 years ago

I would also like to see Mathematica support this kind of graph, and also a stacked line graph such as: enter image description here

While I realize such graphs can be scaled to give a false impression to a naive viewer, they are none-the-less useful and in wide use. The scaling trick employed in the linked example would not be employed by a serious author, accepted by journal referees, or deceive readers of reputable journals.

Additionally, I would like to see Wolfram commit to supporting the types of graphics most typically employed in scientific journals, with built-in functionality, such that it can be conveniently used without low level programming. If I were doing this myself, I would first assemble a list of representative journals. (My list would include Science, Nature, Physical Review, IEEE Spectrum, . . . ) I would review the author guidelines for each, and then the graphics actually printed in some past collection of articles. I would use this as a guide to improving the graphics capabilities of the core Mathematica product.

Kind regards,

David

POSTED BY: David Keith
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract