You are on page 1of 10

How to Display Mesh Points

In[4]:= Plot [Sin [x ^ 2], {x, 0, 2 * Pi }, Mesh → All ]


1.0

0.5

Out[4]=
1 2 3 4 5 6

-0.5

-1.0

In[5]:= Plot [Sin [x ^ 2], {x, 0, 2 * Pi }, Mesh → Full ]


1.0

0.5

Out[5]=
1 2 3 4 5 6

-0.5

-1.0

In[6]:= Plot [Sin [x ^ 2], {x, 0, 2 * Pi }, Mesh → 10 ]


1.0

0.5

Out[6]=
1 2 3 4 5 6

-0.5

-1.0
2

How to Add Colors and Other Style Changes


In[7]:= Plot [2 (x - 4) ^ 2 + 1, {x, 3, 5}, PlotStyle → Red ]
3.0

2.5

Out[7]= 2.0

1.5

3.5 4.0 4.5 5.0

In[8]:= Plot [2 (x - 4) ^ 2 + 1, {x, 3, 5}, PlotStyle → Lighter [Red ]]


3.0

2.5

Out[8]= 2.0

1.5

3.5 4.0 4.5 5.0

In[9]:= Plot [2 (x - 4) ^ 2 + 1, {x, 3, 5}, PlotStyle → Darker [Red ]]


3.0

2.5

Out[9]= 2.0

1.5

3.5 4.0 4.5 5.0


3

In[15]:= Manipulate [Plot [2 (x - 4) ^ 2 + 1, {x, 3, 5}, PlotStyle → Lighter [Red, a]], {a, 0, 1}]

3.0

2.5

Out[15]=

2.0

1.5

3.5 4.0 4.5 5.0

In[19]:= Plot [2 (x - 4) ^ 2 + 1, {x, 3, 5}, PlotStyle → Darker [Red, .2 ]]


3.0

2.5

Out[19]= 2.0

1.5

3.5 4.0 4.5 5.0

In[22]:= Plot [2 (x - 4) ^ 2 + 1, {x, 3, 5}, PlotStyle → Blend [{Green , Red }, .7 ]]


3.0

2.5

Out[22]= 2.0

1.5

3.5 4.0 4.5 5.0


4

In[23]:= Plot [2 (x - 4) ^ 2 + 1, {x, 3, 5}, PlotStyle → Lighter [Blend [{Green , Red }, .7 ], .3 ]]


3.0

2.5

Out[23]= 2.0

1.5

3.5 4.0 4.5 5.0

In[24]:= Plot [2 (x - 4) ^ 2 + 1, {x, 3, 5}, PlotStyle → Directive [Thick , Red, Dashed ]]


3.0

2.5

Out[24]= 2.0

1.5

3.5 4.0 4.5 5.0

Question: 1. Plot the function f(x) = log(x) in [2,10] with axis origin (0,0) with aspect ratio 2 and 0⩽ f(x) ≤
2.

Question:2 Plot the function g(x) = Cos(2*x) in [0, Pi] with -1⩽ g(x) ≤ 1 having green color. Use mesh
points on graph as well.

Question: 3 Manipulate the plot the function h(x) = e^x in [0,a], use mixture of red and blue color where
1 ≤ a ≤ 3.
5

In[25]:= Plot [Log [x], {x, 2, 10 }, AxesOrigin → {0, 0}, AspectRatio → 2, PlotRange → {0, 2}]
2.0

1.5

Out[25]= 1.0

0.5

0 2 4 6 8 10

In[27]:= Plot [Cos [2 * x], {x, 0, Pi }, PlotRange → {- 1, 1}, PlotStyle → Green , Mesh → Full ]
1.0

0.5

Out[27]=
0.5 1.0 1.5 2.0 2.5 3.0

-0.5

-1.0
6

In[28]:= Manipulate [Plot [Exp [x], {x, 0, a}, PlotStyle → Blend [{Red, Blue }, .3 ]], {a, 1, 3}]

20

15

Out[28]=

10

0.5 1.0 1.5 2.0 2.5 3.0

In[32]:= Plot [2 (x - 4) ^ 2 + 1, {x, 3, 5}, PlotStyle → Directive [Thick , Red, Dashed ]]


3.0

2.5

Out[32]= 2.0

1.5

3.5 4.0 4.5 5.0

In[33]:= Plot [2 (x - 4) ^ 2 + 1, {x, 3, 5}, PlotStyle → Dashing [Small ]]


3.0

2.5

Out[33]= 2.0

1.5

3.5 4.0 4.5 5.0


7

In[34]:= Plot [2 (x - 4) ^ 2 + 1, {x, 3, 5}, PlotStyle → Dashing [Large ]]


3.0

2.5

Out[34]= 2.0

1.5

3.5 4.0 4.5 5.0

In[37]:= Plot [2 (x - 4) ^ 2 + 1, {x, 3, 5}, PlotStyle → Dashing [{.02, .01 }]]


3.0

2.5

Out[37]= 2.0

1.5

3.5 4.0 4.5 5.0

In[43]:= Plot [2 (x - 4) ^ 2 + 1, {x, 3, 5}, PlotStyle → Thickness [.01 ]]


3.0

2.5

Out[43]= 2.0

1.5

3.5 4.0 4.5 5.0


8

How to Remove the Axes or Add a Frame


In[44]:= Plot [2 (x - 4) ^ 2 + 1, {x, 3, 5}, Axes → False ]

Out[44]=

In[45]:= Plot [2 (x - 4) ^ 2 + 1, {x, 3, 5}, Frame → True ]


3.0

2.5

2.0
Out[45]=

1.5

1.0

3.0 3.5 4.0 4.5 5.0

In[48]:= Plot [2 (x - 4) ^ 2 + 1, {x, 3, 5}, AxesStyle → Arrowheads [.05 ]]

2.5

Out[48]= 2.0

1.5

3.5 4.0 4.5


9

In[53]:= Plot [2 (x - 4) ^ 2 - 21, {x, - 5, 5}, AxesStyle → Arrowheads [{- .05, .05 }], AxesOrigin → {0, 0}]

100

Out[53]=
50

-4 -2 2 4

How to Add Grid Lines and Adjust Ticks on the Axes


In[54]:= Plot [Sin [x], {x, 0, 2 * Pi }, GridLines → Automatic ]
1.0

0.5

Out[54]=
1 2 3 4 5 6

-0.5

-1.0

In[57]:= Plot [Sin [x], {x, 0, 2 * Pi }, GridLines → Automatic ,


GridLinesStyle → Directive [Thin, Red, Dashed ]]

1.0

0.5

Out[57]=
1 2 3 4 5 6

-0.5

-1.0
10

In[61]:= Plot [Sin [x], {x, 0, 2 * Pi }, GridLines → {{Pi / 2, Pi, 3 * Pi / 2, 2 * Pi }, {- 1, - .5, 0, .5, 1}},
GridLinesStyle → Directive [Thin, Red, Dashed ]]

1.0

0.5

Out[61]=
1 2 3 4 5 6

-0.5

-1.0

In[64]:= Plot [Sin [x], {x, 0, 2 * Pi }, GridLines → {Range [0, 2 * Pi, Pi / 4], Range [- 1, 1, .5 ]},
GridLinesStyle → Directive [Thin, Red, Dashed ]]

1.0

0.5

Out[64]=
1 2 3 4 5 6

-0.5

-1.0

Plot [Sin [x], {x, 0, 2 * Pi }, GridLines → {Range [0, 2 * Pi, Pi /


4], Automatic }, GridLinesStyle → Directive [Thin, Red, Dashed ]]

You might also like