How can I replace x-axis labels with pre-determined symbols? [on hold]
$begingroup$
I want to take a simple plot and change the x-axis so it appears to be measured in terms of certain symbols that are used in the physics literature. See the image below for an example.
I will rephrase this as follows: I have some set of numerical coordinates which trace out the curves in my plot. For equal spacings on the x-axis (say once every 100 points), I want to label the line $x=100,n$ with a symbol.
I don't know how to do this. The documentation provided by Mathematica didn't help me. This doesn't seem like something done by just changing the ticks settings.
plotting labeling
$endgroup$
put on hold as off-topic by Bob Hanlon, MarcoB, corey979, Carl Lange, Alex Trounev yesterday
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – Bob Hanlon, MarcoB, corey979, Carl Lange, Alex Trounev
If this question can be reworded to fit the rules in the help center, please edit the question.
add a comment |
$begingroup$
I want to take a simple plot and change the x-axis so it appears to be measured in terms of certain symbols that are used in the physics literature. See the image below for an example.
I will rephrase this as follows: I have some set of numerical coordinates which trace out the curves in my plot. For equal spacings on the x-axis (say once every 100 points), I want to label the line $x=100,n$ with a symbol.
I don't know how to do this. The documentation provided by Mathematica didn't help me. This doesn't seem like something done by just changing the ticks settings.
plotting labeling
$endgroup$
put on hold as off-topic by Bob Hanlon, MarcoB, corey979, Carl Lange, Alex Trounev yesterday
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – Bob Hanlon, MarcoB, corey979, Carl Lange, Alex Trounev
If this question can be reworded to fit the rules in the help center, please edit the question.
$begingroup$
Provide sample data to work with
$endgroup$
– MarcoB
Apr 1 at 17:53
$begingroup$
The curves can be anything. You can just plot a simple function if you like. This is just an illustration of how I want to format the axis, not real data.
$endgroup$
– miggle
Apr 1 at 18:13
$begingroup$
FrameTicks
$endgroup$
– corey979
2 days ago
add a comment |
$begingroup$
I want to take a simple plot and change the x-axis so it appears to be measured in terms of certain symbols that are used in the physics literature. See the image below for an example.
I will rephrase this as follows: I have some set of numerical coordinates which trace out the curves in my plot. For equal spacings on the x-axis (say once every 100 points), I want to label the line $x=100,n$ with a symbol.
I don't know how to do this. The documentation provided by Mathematica didn't help me. This doesn't seem like something done by just changing the ticks settings.
plotting labeling
$endgroup$
I want to take a simple plot and change the x-axis so it appears to be measured in terms of certain symbols that are used in the physics literature. See the image below for an example.
I will rephrase this as follows: I have some set of numerical coordinates which trace out the curves in my plot. For equal spacings on the x-axis (say once every 100 points), I want to label the line $x=100,n$ with a symbol.
I don't know how to do this. The documentation provided by Mathematica didn't help me. This doesn't seem like something done by just changing the ticks settings.
plotting labeling
plotting labeling
edited Apr 2 at 0:54
m_goldberg
88.1k872199
88.1k872199
asked Apr 1 at 17:17
migglemiggle
30016
30016
put on hold as off-topic by Bob Hanlon, MarcoB, corey979, Carl Lange, Alex Trounev yesterday
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – Bob Hanlon, MarcoB, corey979, Carl Lange, Alex Trounev
If this question can be reworded to fit the rules in the help center, please edit the question.
put on hold as off-topic by Bob Hanlon, MarcoB, corey979, Carl Lange, Alex Trounev yesterday
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – Bob Hanlon, MarcoB, corey979, Carl Lange, Alex Trounev
If this question can be reworded to fit the rules in the help center, please edit the question.
$begingroup$
Provide sample data to work with
$endgroup$
– MarcoB
Apr 1 at 17:53
$begingroup$
The curves can be anything. You can just plot a simple function if you like. This is just an illustration of how I want to format the axis, not real data.
$endgroup$
– miggle
Apr 1 at 18:13
$begingroup$
FrameTicks
$endgroup$
– corey979
2 days ago
add a comment |
$begingroup$
Provide sample data to work with
$endgroup$
– MarcoB
Apr 1 at 17:53
$begingroup$
The curves can be anything. You can just plot a simple function if you like. This is just an illustration of how I want to format the axis, not real data.
$endgroup$
– miggle
Apr 1 at 18:13
$begingroup$
FrameTicks
$endgroup$
– corey979
2 days ago
$begingroup$
Provide sample data to work with
$endgroup$
– MarcoB
Apr 1 at 17:53
$begingroup$
Provide sample data to work with
$endgroup$
– MarcoB
Apr 1 at 17:53
$begingroup$
The curves can be anything. You can just plot a simple function if you like. This is just an illustration of how I want to format the axis, not real data.
$endgroup$
– miggle
Apr 1 at 18:13
$begingroup$
The curves can be anything. You can just plot a simple function if you like. This is just an illustration of how I want to format the axis, not real data.
$endgroup$
– miggle
Apr 1 at 18:13
$begingroup$
FrameTicks
$endgroup$
– corey979
2 days ago
$begingroup$
FrameTicks
$endgroup$
– corey979
2 days ago
add a comment |
1 Answer
1
active
oldest
votes
$begingroup$
This can be done using either Ticks
if you're using axes or FrameTicks
if you're using a frame on your plot. I made up a plot since I'm not sure the exact data matters.
Most of the code below is flair to make the graph look a bit nicer. The important bit is FrameTicks
. I've told MMA to use its best judgement for 3 of the 4 sides of the graph. For plots, the order is usually {{left, right}, {bottom, top}}
, though for certain things you can get away with only 2 arguments {x-argument, y-argument}
.
For each side of the frame, FrameTicks
is expecting a list of ticks and the label to put on those ticks, so in place of bottom
from the above list, I would put something like {{x-value1, "x-label1"}, {x-value2, "x-label2"}, ...}
. It is also possible to specify the lengths of the ticks in this way: {{x-value1, "x-label1", {insidelength1, outsidelength1}}, {x-value2, "x-label2", {insidelength2, outsidelength2}}, ...}
.
Plot[
Piecewise[
{{-(x - 5)^2 + 50, 0 <= x <= 10},
{-(x - 10)^2 + 25, 10 < x < 15}}],
{x, 0, 15},
Axes -> False,
Frame -> {{True, False}, {True, False}},
FrameLabel -> {{"E (eV)", None}, {"k-space", None}},
FrameStyle -> Directive[16, Black],
FrameTicks ->
{{Automatic, Automatic}, {{{0, "K"}, {5, "Γ"}, {10, "M"}, {15, "K"}}, Automatic}},
ImageSize -> 500,
Epilog -> {
Dashing[{0.001, 0.01}],
Line[{{0, -1}, {0, 25}}],
Line[{{5, -1}, {5, 50}}],
Line[{{10, -1}, {10, 25}}],
Line[{{15, -1}, {15, 0}}]
}
]
$endgroup$
$begingroup$
Beautiful, thanks a lot! Much easier to understand in the context of using a frame.
$endgroup$
– miggle
Apr 1 at 18:29
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
$begingroup$
This can be done using either Ticks
if you're using axes or FrameTicks
if you're using a frame on your plot. I made up a plot since I'm not sure the exact data matters.
Most of the code below is flair to make the graph look a bit nicer. The important bit is FrameTicks
. I've told MMA to use its best judgement for 3 of the 4 sides of the graph. For plots, the order is usually {{left, right}, {bottom, top}}
, though for certain things you can get away with only 2 arguments {x-argument, y-argument}
.
For each side of the frame, FrameTicks
is expecting a list of ticks and the label to put on those ticks, so in place of bottom
from the above list, I would put something like {{x-value1, "x-label1"}, {x-value2, "x-label2"}, ...}
. It is also possible to specify the lengths of the ticks in this way: {{x-value1, "x-label1", {insidelength1, outsidelength1}}, {x-value2, "x-label2", {insidelength2, outsidelength2}}, ...}
.
Plot[
Piecewise[
{{-(x - 5)^2 + 50, 0 <= x <= 10},
{-(x - 10)^2 + 25, 10 < x < 15}}],
{x, 0, 15},
Axes -> False,
Frame -> {{True, False}, {True, False}},
FrameLabel -> {{"E (eV)", None}, {"k-space", None}},
FrameStyle -> Directive[16, Black],
FrameTicks ->
{{Automatic, Automatic}, {{{0, "K"}, {5, "Γ"}, {10, "M"}, {15, "K"}}, Automatic}},
ImageSize -> 500,
Epilog -> {
Dashing[{0.001, 0.01}],
Line[{{0, -1}, {0, 25}}],
Line[{{5, -1}, {5, 50}}],
Line[{{10, -1}, {10, 25}}],
Line[{{15, -1}, {15, 0}}]
}
]
$endgroup$
$begingroup$
Beautiful, thanks a lot! Much easier to understand in the context of using a frame.
$endgroup$
– miggle
Apr 1 at 18:29
add a comment |
$begingroup$
This can be done using either Ticks
if you're using axes or FrameTicks
if you're using a frame on your plot. I made up a plot since I'm not sure the exact data matters.
Most of the code below is flair to make the graph look a bit nicer. The important bit is FrameTicks
. I've told MMA to use its best judgement for 3 of the 4 sides of the graph. For plots, the order is usually {{left, right}, {bottom, top}}
, though for certain things you can get away with only 2 arguments {x-argument, y-argument}
.
For each side of the frame, FrameTicks
is expecting a list of ticks and the label to put on those ticks, so in place of bottom
from the above list, I would put something like {{x-value1, "x-label1"}, {x-value2, "x-label2"}, ...}
. It is also possible to specify the lengths of the ticks in this way: {{x-value1, "x-label1", {insidelength1, outsidelength1}}, {x-value2, "x-label2", {insidelength2, outsidelength2}}, ...}
.
Plot[
Piecewise[
{{-(x - 5)^2 + 50, 0 <= x <= 10},
{-(x - 10)^2 + 25, 10 < x < 15}}],
{x, 0, 15},
Axes -> False,
Frame -> {{True, False}, {True, False}},
FrameLabel -> {{"E (eV)", None}, {"k-space", None}},
FrameStyle -> Directive[16, Black],
FrameTicks ->
{{Automatic, Automatic}, {{{0, "K"}, {5, "Γ"}, {10, "M"}, {15, "K"}}, Automatic}},
ImageSize -> 500,
Epilog -> {
Dashing[{0.001, 0.01}],
Line[{{0, -1}, {0, 25}}],
Line[{{5, -1}, {5, 50}}],
Line[{{10, -1}, {10, 25}}],
Line[{{15, -1}, {15, 0}}]
}
]
$endgroup$
$begingroup$
Beautiful, thanks a lot! Much easier to understand in the context of using a frame.
$endgroup$
– miggle
Apr 1 at 18:29
add a comment |
$begingroup$
This can be done using either Ticks
if you're using axes or FrameTicks
if you're using a frame on your plot. I made up a plot since I'm not sure the exact data matters.
Most of the code below is flair to make the graph look a bit nicer. The important bit is FrameTicks
. I've told MMA to use its best judgement for 3 of the 4 sides of the graph. For plots, the order is usually {{left, right}, {bottom, top}}
, though for certain things you can get away with only 2 arguments {x-argument, y-argument}
.
For each side of the frame, FrameTicks
is expecting a list of ticks and the label to put on those ticks, so in place of bottom
from the above list, I would put something like {{x-value1, "x-label1"}, {x-value2, "x-label2"}, ...}
. It is also possible to specify the lengths of the ticks in this way: {{x-value1, "x-label1", {insidelength1, outsidelength1}}, {x-value2, "x-label2", {insidelength2, outsidelength2}}, ...}
.
Plot[
Piecewise[
{{-(x - 5)^2 + 50, 0 <= x <= 10},
{-(x - 10)^2 + 25, 10 < x < 15}}],
{x, 0, 15},
Axes -> False,
Frame -> {{True, False}, {True, False}},
FrameLabel -> {{"E (eV)", None}, {"k-space", None}},
FrameStyle -> Directive[16, Black],
FrameTicks ->
{{Automatic, Automatic}, {{{0, "K"}, {5, "Γ"}, {10, "M"}, {15, "K"}}, Automatic}},
ImageSize -> 500,
Epilog -> {
Dashing[{0.001, 0.01}],
Line[{{0, -1}, {0, 25}}],
Line[{{5, -1}, {5, 50}}],
Line[{{10, -1}, {10, 25}}],
Line[{{15, -1}, {15, 0}}]
}
]
$endgroup$
This can be done using either Ticks
if you're using axes or FrameTicks
if you're using a frame on your plot. I made up a plot since I'm not sure the exact data matters.
Most of the code below is flair to make the graph look a bit nicer. The important bit is FrameTicks
. I've told MMA to use its best judgement for 3 of the 4 sides of the graph. For plots, the order is usually {{left, right}, {bottom, top}}
, though for certain things you can get away with only 2 arguments {x-argument, y-argument}
.
For each side of the frame, FrameTicks
is expecting a list of ticks and the label to put on those ticks, so in place of bottom
from the above list, I would put something like {{x-value1, "x-label1"}, {x-value2, "x-label2"}, ...}
. It is also possible to specify the lengths of the ticks in this way: {{x-value1, "x-label1", {insidelength1, outsidelength1}}, {x-value2, "x-label2", {insidelength2, outsidelength2}}, ...}
.
Plot[
Piecewise[
{{-(x - 5)^2 + 50, 0 <= x <= 10},
{-(x - 10)^2 + 25, 10 < x < 15}}],
{x, 0, 15},
Axes -> False,
Frame -> {{True, False}, {True, False}},
FrameLabel -> {{"E (eV)", None}, {"k-space", None}},
FrameStyle -> Directive[16, Black],
FrameTicks ->
{{Automatic, Automatic}, {{{0, "K"}, {5, "Γ"}, {10, "M"}, {15, "K"}}, Automatic}},
ImageSize -> 500,
Epilog -> {
Dashing[{0.001, 0.01}],
Line[{{0, -1}, {0, 25}}],
Line[{{5, -1}, {5, 50}}],
Line[{{10, -1}, {10, 25}}],
Line[{{15, -1}, {15, 0}}]
}
]
edited Apr 2 at 0:41
m_goldberg
88.1k872199
88.1k872199
answered Apr 1 at 18:15
MassDefectMassDefect
2,140311
2,140311
$begingroup$
Beautiful, thanks a lot! Much easier to understand in the context of using a frame.
$endgroup$
– miggle
Apr 1 at 18:29
add a comment |
$begingroup$
Beautiful, thanks a lot! Much easier to understand in the context of using a frame.
$endgroup$
– miggle
Apr 1 at 18:29
$begingroup$
Beautiful, thanks a lot! Much easier to understand in the context of using a frame.
$endgroup$
– miggle
Apr 1 at 18:29
$begingroup$
Beautiful, thanks a lot! Much easier to understand in the context of using a frame.
$endgroup$
– miggle
Apr 1 at 18:29
add a comment |
$begingroup$
Provide sample data to work with
$endgroup$
– MarcoB
Apr 1 at 17:53
$begingroup$
The curves can be anything. You can just plot a simple function if you like. This is just an illustration of how I want to format the axis, not real data.
$endgroup$
– miggle
Apr 1 at 18:13
$begingroup$
FrameTicks
$endgroup$
– corey979
2 days ago