Skip to main content
34 events
when toggle format what by license comment
Jun 8, 2017 at 0:02 history edited Mr.Wizard CC BY-SA 3.0
edited body
Apr 13, 2017 at 12:56 history edited CommunityBot
replaced http://mathematica.stackexchange.com/ with https://mathematica.stackexchange.com/
Sep 16, 2016 at 0:28 vote accept Moodragonx
Dec 23, 2015 at 8:22 vote accept Moodragonx
Sep 16, 2016 at 0:28
Jul 13, 2014 at 21:45 history edited Mr.Wizard CC BY-SA 3.0
deleted 61 characters in body
May 26, 2014 at 21:30 comment added Mr.Wizard @Moodragonx You can wait to Accept an answer if you like. Also, should it not work with the built-in legend system you can still build a legend from Graphics primitives as Jens did here. Anyway, I hope to see you back here this autumn.
May 26, 2014 at 20:48 comment added Moodragonx @Mr.Wizard I am currently away from a machine with Mathematica on it and will not have access until the next semester begins in the fall. In the meantime I'm not really sure what to pick as a "best answer" as I've not yet seen if your method works with a legend for a non-buggy version of Mathematica.
May 16, 2014 at 17:38 comment added Mr.Wizard @Moodragonx Apparently the problem is a bug in version 9.0.0. Can you confirm that is what you are using?
May 16, 2014 at 17:30 comment added Mr.Wizard @Rahul A little late but interesting nevertheless. Please post any further observations here. Thanks. :-)
May 16, 2014 at 17:23 comment added user484 Interesting news: Both definitions work fine on Mathematica 9.0.1.0 on Linux. My previous comments were on Mathematica 9.0.0.0 on Mac.
May 16, 2014 at 16:53 comment added Moodragonx @RahulNarain Ah, yes I removed the BaseStyle -> {14, Thick}, to conceal the fact that the other functions are still being plotted at 0. Perhaps not the best solution since there are times when the x-axis won't align with y=0, and just that it seems inelligent. But using Indeterminate seems to force no other functions to be plotted on those intervals.
May 16, 2014 at 16:47 comment added user484 @Mr.Wizard: I see the same behaviour as Moodragonx's last two comments, presumably because we're on the same version of Mathematica. However, instead of the curves stopping they drop to zero: i.sstatic.net/J5AIb.png
May 16, 2014 at 16:42 comment added Moodragonx @Mr.Wizard Hmm... neither version of prep currently work for me (I am on Mathematica 9.0 if that is elucidating), but the form I cited before does.
May 16, 2014 at 16:41 comment added Mr.Wizard @Rahul You too, please, if you have time.
May 16, 2014 at 16:41 comment added Mr.Wizard @Moodragonx Would you please see if the new "for version 8" code works as expected? I wish they hadn't changed things...
May 16, 2014 at 16:40 comment added Mr.Wizard @Moodragonx Apparently the changed how both If and Indeterminate behave. I guess you are supposed to use ConditionalExpression now. I'll stick that in my answer too.
May 16, 2014 at 16:40 history edited Mr.Wizard CC BY-SA 3.0
deleted 28 characters in body
May 16, 2014 at 16:39 comment added Moodragonx @Mr.Wizard, i.e. Your middle definition of prep[fn_][a__] := Piecewise[{{#, # == fn[a]}}] & /@ {a}, seems to work for me (when specifying the PlotRange).
May 16, 2014 at 16:36 comment added Moodragonx Removing the "Indeterminate" parameter in Piecewise (and thus letting the default value of the function settle at 0 where you can not see it over the axes bars) seems to fix the error on my end. Also adding PlotRange -> All seems necessary.
May 16, 2014 at 16:32 history edited Mr.Wizard CC BY-SA 3.0
added 26 characters in body
May 16, 2014 at 16:32 comment added user484 No, that doesn't help either.
May 16, 2014 at 16:29 comment added Mr.Wizard @Rahul Please try my "New method" with this: prep[fn_][a__] := Piecewise[{{#, # == fn[a]}}, Indeterminate] & /@ {a}
May 16, 2014 at 16:27 comment added user484 On my machine Plot seems to give up as soon as any of the functions are Undefined everywhere. So I don't think Piecewise would help. That's why I had to use RegionFunction in my answer.
May 16, 2014 at 16:26 comment added Mr.Wizard @Rahul Well bollocks. Does Piecewise work for you? I can update my answer to use that instead, though it's a little more verbose.
May 16, 2014 at 16:25 comment added user484 Hmm, your "new method" just gives me a blank plot. (Mathematica 9 on Mac OS X.)
May 16, 2014 at 16:19 history edited Mr.Wizard CC BY-SA 3.0
added 671 characters in body
May 16, 2014 at 15:47 comment added Mr.Wizard @Moodragonx Unsurprising, really. Let me think about how to approach that problem, at least with the tools I have.
May 16, 2014 at 15:45 comment added Moodragonx Thanks for the clarification. Just thought I'd confirm that PlotLegends -> "Expressions" doesn't provide a separate legend entry for each section of the curve (which I expected since it is still only a single function f[x] being plotted).
May 16, 2014 at 15:41 comment added Mr.Wizard @Moodragonx More notes added. Sorry I can't help with the PlotLegends option, at least not directly.
May 16, 2014 at 15:40 history edited Mr.Wizard CC BY-SA 3.0
deleted 1 character in body
May 16, 2014 at 15:28 comment added Mr.Wizard @Moodragonx You're welcome.
May 16, 2014 at 15:28 history edited Mr.Wizard CC BY-SA 3.0
deleted 1 character in body
May 16, 2014 at 15:27 comment added Moodragonx Thank you for the prompt response. This doesn't seem to address the generation of a legend request here, however. Will the PlotLegends option used in my question still work to handle this? Further, being new to mathematica the syntax or methods used here are a little lost on me. I'll read up on this but further explanation of how this works would be awesome and whether I should have a reason to choose one method over the other would be appreciated as well.
May 16, 2014 at 15:20 history answered Mr.Wizard CC BY-SA 3.0