Home > graphics > How to highlight various parts of a plot

How to highlight various parts of a plot

August 11Hits:4
Advertisement

I'd like to show students a graph of a function, say $(x,y)\mapsto\sqrt[3]{x^3+y^3}$, and then highlight its various properties connected with (non)differentiability at certain points etc. Having some lines included in the graph seems a good idea. Now I'd like to be able to highlight (by using different colors and/or thicker lines) some of these lines. It would be best if I could press or click something so that one or another line gets "selected" (highlighted). How to achieve something like this?

Note: I'll be fully satisfied with one-line, RTFM-style answers, if someone could provide me a hint where to look for the FM; I'm new to Mathematica and feel a bit overwhelmed by the multitude of documentation in various formats...

Answers

In addition to my comment, I guess I could also point out that Mathematica plots can be combined using the Show command. So you could define two different plots as follows and then combine them:

f[x_, y_] := (x^3 + y^3)^(1/3)

surface = Plot3D[f[x, y], {x, -2, 2}, {y, -2, 2}];

line = ParametricPlot3D[
   With[{x = t, y = t}, {x, y, f[x, y]}], {t, 0, 2},
   PlotStyle -> {Red, Tube[.03]}];

Show[surface, line]

How to highlight various parts of a plot

Edit

Looks like you may also want to read about Manipulate, as shown in this example:

Manipulate[Show[surface,
  ParametricPlot3D[With[{x = t, y = t}, {x, y, f[x, y]}], {t, 0, 2},
   PlotStyle -> {style, Tube[.03]}]],
 {style, {Red, Directive[Opacity[.5], Blue]}}]

How to highlight various parts of a plot

Here I just added the bare minimum to the previous example to make the color of the added line controllable by clicking a button.

Related Articles

  • How to highlight various parts of a plot

    How to highlight various parts of a plotAugust 11

    I'd like to show students a graph of a function, say $(x,y)\mapsto\sqrt[3]{x^3+y^3}$, and then highlight its various properties connected with (non)differentiability at certain points etc. Having some lines included in the graph seems a good idea. No

  • Highlight selected curve on the plot

    Highlight selected curve on the plotNovember 5

    I have several curves on the same parametric 3D plot and I would like to highlight some curves dynamically by choosing them from list. sol = Solve[ 2 x + 2 x^2 - 3 x^3 + 26 x^4 + 32 x^5 + 21 x^6 - 18 x^7 == r, {x}]; lolAux[r_] = x /. sol; ParametricP

  • Highlight selected points in a plot

    Highlight selected points in a plotMay 4

    I need to change color to selected points dynamically in my plot. clicks = {}; insert = 0; Column[{ ListPlot[Button[Tooltip@#, If[insert < 5 && ! MemberQ[clicks, #], AppendTo[clicks, #]; insert++;]] & /@ [email protected], ImageSize -> 300], "

  • Highlighted selected country on R plotJanuary 23

    I would like to plot a high resolution map of Europe with highlighted selected country – in my case Slovenia. So Slovenia should be in red color. There is one solution already described, but map is outdated and Slovenia is no longer belonging to Yugo

  • How can I highlight one function in the Plot of a list?

    How can I highlight one function in the Plot of a list?July 11

    I've got a Plot of a list of functions from this previous question of mine. rp[x_, r_] := 1000 x (r + 1)/(r + x) ratios = Table[10^n, {n, -2, 2, 4/10}] Plot[Map[rp[x, #] &, ratios], {x, 0, 1}, Evaluated -> True] Now I want the sixth function, where

  • How to highlight (differentiate) negative numbers in plots?

    How to highlight (differentiate) negative numbers in plots? February 8

    I want to clearly see negative values in 3D plots. How can I do it? --------------Solutions------------- A simple alternative is Plot3D[Sin[x y], {x, 0, 3}, {y, 0, 3}, ColorFunction -> (If[#3 > 0, Red, Green] &), ColorFunctionScaling -> False

  • legend problem in highlighting a data plot

    legend problem in highlighting a data plotAugust 14

    I followed the tips on highlighting in data plots at http://www.howtotex.com/tips-tricks/highlighting-in-tikz-plots/ The highlighting does not work well with \addlegendentry. A MWE is shown below. \documentclass{article} \usepackage{tikz} \usepackage

  • pgfplots - highlighting/filling an area in a data file

    pgfplots - highlighting/filling an area in a data fileMarch 19

    How does one highlight a specific domain range of a datafile in pgfplots? For example I'd like do do something like: \begin{tikzpicture}[baseline,trim axis left] \begin{axis}[ ylabel=frequency, y unit=\si{\hertz}, ] \addplot file {mydata.dat}; % myst

  • How to create an effective PlotLegend when plotting many ListPlots?

    How to create an effective PlotLegend when plotting many ListPlots?November 17

    I'm creating a ListPlot where I plot many data sets simultaneously. Currently, my code that produces it is something like this: ListPlot[alldat, PlotStyle -> "Rainbow", PlotLegends -> SwatchLegend["Rainbow", flist]] Where alldat

  • Create bar chart with description from file

    Create bar chart with description from fileJanuary 20

    I'd like to create a bar chart read data directly from file, add detailed description directly inside/over the bars and write the actual value near the actual coord set bar color according to a column my preferred result would look like this: That's

  • Customizing the look of a ListPlot3D

    Customizing the look of a ListPlot3DSeptember 22

    I show my data bellow, and I want to use ListPlot3D to make a plot of that data. In this process I have some problems that I will discuss them step by step: list={{0., 0.2, 0.1}, {0., 0.4, 0.2}, {0., 0.6, 0.3}, {0., 0.8, 0.4}, {0., 1., 0.5}, {0., 1.2

  • How can I highlight the vanishing-partials in an interactive 3D plot?

    How can I highlight the vanishing-partials in an interactive 3D plot?March 15

    I am using Manipulate and Plot3D to plot a function with two real variables and two extra parameters. f[x_, y_, alpha_, gamma_] := x*y + alpha*x - Log[Power[x, gamma]*y] Manipulate[ Plot3D[f[x, y, alpha, gamma], {x, 0, 5}, {y, 0, 5}, PlotStyle -> Opa

  • Highlighting a single Period of a Trig Plot

    Highlighting a single Period of a Trig PlotSeptember 29

    How do I highlight a single period of a trig function say by using color and/or thickness when the graph itself extends further than just a single period? Thanks...Gregory Lane --------------Solutions------------- Plot[Sin[x], {x, -4 Pi, 4 Pi}, Mesh

  • inset plot with pgfplots

    inset plot with pgfplotsMay 20

    I am using pgfplots to plot some data I have, and I wanted to generate a large plot with another plot inside of it, showing a zoom on a region of the large plot. I have noticed that when you do \begin{tikzpicture} \begin{axis}[width=0.45\textwidth] %

  • pgfplots, ybar-plot: how to mark a missing value?

    pgfplots, ybar-plot: how to mark a missing value?May 27

    I'm very, very happy with pgfplots and using the ybar-plot-function to create a lot of diagrams. At the moment I wonders if it is possible to mark a missing value, for example with an asterisk. As you can see in the following example, one can easily

  • How to plot Venn diagrams with Mathematica?

    How to plot Venn diagrams with Mathematica?March 3

    How does one plot Venn diagrams with Mathematica? I've searched quite a bit and I've found one source at MathWorld which provides the source code for doing them. But I don't understand this code, can someone help me? --------------Solutions----------

  • How to plot points on maps using ggplot2 and R?March 3

    Thanks for help me in GIS 101 Problem #1, now I have geocoded a few hospital in Connecticut using google map, I have able to visualize them in QGIS, now I am trying to do it in R. ct <- readShapeSpatial("housect_37800_0000_2010_s100_census_1_shp/w

  • Fixing quirky typesetting in plot labels

    Fixing quirky typesetting in plot labelsApril 3

    Consider this example plot. Plot[ 1-Exp[-x], {x,0,3}, AxesLabel->{"thickness (μm)","power density (W/m^2)"} ] Let us hold the typographical quality of the labels to the standard set by LaTeX. There are four distracting quirks: The &

  • Creating legends for plots with multiple lines?

    Creating legends for plots with multiple lines?April 7

    So I have a graph with multiple lists, for e.g. data = {{1,2}, {3,4}, {3,5}, {2,3} . . .} If I then do ListLinePlot[Table[{#1,Log[b,#2]}&@@@data, {b,1,10,2}]] I have no way to generate a legend for it, that I see anyway. I cannot put anything inside

  • Plot with Legends and Markers

    Plot with Legends and Markers April 7

    So I have a graph with multiple lists, for e.g. data = {{1,2}, {3,4}, {3,5}, {2,3} . . .} If I then do ListLinePlot[Table[{#1,Log[b,#2]}&@@@data, {b,1,10,2}]] I have no way to generate a legend for it, that I see anyway. I cannot put anything inside

Copyright (C) 2017 ceus-now.com, All Rights Reserved. webmaster#ceus-now.com 14 q. 0.530 s.