3
$\begingroup$

I try to use the general code, i.e., Ticks -> {{x1,label1},{x2,label2},…}, to specify tick marks in the function of ParallelAxisPlot but it doesn't work. Is there any other ways to specify tick marks in the function of ParallelAxisPlot? Many thanks!

Here is a toy example.

ParallelAxisPlot[{{6, 13, 5, 9}, {10, 5, 8, 3}, {2, 8, 3, 1}}, PlotRange -> {{0, 12}, {3, 13}, {2, 10}, {0, 10}}, Ticks -> Automatic]

Fig01-Test

I try to use the general code, i.e., Ticks -> {{x1,label1},{x2,label2},…}, to specify the tick marks. It gives me a result like this. The code, i.e., {a, b, c, d, e} works with no problem. It will put the labels on the side of the ticks. However, the code, i.e., {13, "here"} has an issue now. I want to put a label "here" on the side of 13 of the 2nd axis. I don't know how to make it work in the function of ParallelAxisPlot.

In addition, is there any way to manually adjust the intervals of the ticks in the given PlotRange? For example, the 1st axis has 6 intervals but the 4th axis has 5 intervals. These intervals are divided automatically. In fact, the general code, i.e., Ticks -> {{x1,label1},{x2,label2},…} works for me to manually adjust such intervals in other plotting functions but it doesn't work in this function.

ParallelAxisPlot[{{6, 13, 5, 9}, {10, 5, 8, 3}, {2, 8, 3, 1}}, PlotRange -> {{0, 12}, {3, 13}, {2, 10}, {0, 10}}, Ticks -> {Automatic, {{13, "here"}}, {a, b, c, d, e}, Automatic}]

Fig02-Test

$\endgroup$
2
  • $\begingroup$ Looks to me like you found a bug. Tick specifications are messed up for ParallelAxisPlot. Well done! The workaround will take a lot of work, recreating the graph using graphics primitives inside a Graphics[] command. $\endgroup$
    – Nicholas G
    Jul 26, 2021 at 11:04
  • $\begingroup$ @NicholasG Thanks a lot for your quick reply. We'll see if there are any experts who may find a solution for this case. $\endgroup$
    – Frankie
    Jul 26, 2021 at 12:26

2 Answers 2

1
$\begingroup$

Instead of rebuilding the entire graph from graphics primitives, I use the bug to eliminate the labels for the second axis and add them back in with primitives (Text[]) through an Epilog:

ParallelAxisPlot[{{6, 13, 5, 9}, {10, 5, 8, 3}, {2, 8, 3, 1}}, 
 PlotRange -> {{0, 12}, {3, 13}, {2, 10}, {0, 10}}, 
 Ticks -> {Automatic, {{"", ""}}, {a, b, c, d, e}, Automatic}, 
 Epilog -> Table[Text[i, {.3, -.3 + i/10}], {i, 4, 12, 2}]]

The result appears to be what you seek:

enter image description here

To find the coordinates where to place the text, right-click on the graph in Mathematica and select "get coordinates." Then, as you move your cursor, you see its coordinates according to the graph.

$\endgroup$
0
$\begingroup$

I don't know if there are any experts who can address this problem in a more efficient way. I have found an alternative (the least efficient) way to address my concern. The 1st step is to turn off the 2nd axis and draw another plot with only the customized 2nd axis turning on. Combining the two plots will give us a correct result. This solution is less efficient but it would at least solve this problem. As I am not an expert for programming or codes, I do hope an expert could help us find a better way to address this problem. I'll leave this question open. Many thanks for all contributors!

Attached is the result of my solution.

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.