Message Boards Message Boards

0
|
13943 Views
|
2 Replies
|
0 Total Likes
View groups...
Share
Share this post:

How to remove Ticks from a BarChart3D and put z axis

Posted 10 years ago

Hi guys, I have a problem that i'm not able to solve. I'm plotting a BarChart3D with the following code, and the result is the first image: I'd like to remove the black ticks but i need the numbers, and I can't find a way to remove just those without erase the numbers too..

BarChart3D[ConstantArray[0.00001, {16, 16}],
 ChartLayout -> "Grid",
 Boxed -> False,
 Method -> {"Canvas" -> None},
 FaceGrids -> None,
 AxesOrigin -> {30.5, 32.5, 0}, Axes -> {Automatic, Automatic, None}, 
 AxesStyle -> {White, White, None},
 ChartStyle -> "AvocadoColors", 
 ColorFunction -> Function[{height}, ColorData["Rainbow"][height]],
 PlotRange -> {-0.5, 0.5},
 BarSpacing -> {0.9, 0.9},
 Ticks -> {{{0.5, "1 "}, {2.4, "2 "}, {4.3, "3"}, {6.2, "4"}, {8.1, 
     "5"}, {10, "6 "}, {11.9, "7"}, {13.8, "8"}, {15.7, "9"}, {17.6, 
     "10"}, {19.5, "11"}, {21.4, "12"}, {23.3, "13 "}, {25.2, 
     "14"}, {27.1, "15"}, {29, "16"}}, {{0.5, "1 "}, {2.4, 
     "2 "}, {4.3, "3"}, {6.2, "4"}, {8.1, "5"}, {10, "6 "}, {11.9, 
     "7"}, {13.8, "8"}, {15.7, "9"}, {17.6, "10"}, {19.5, 
     "11"}, {21.4, "12"}, {23.3, "13 "}, {25.2, "14"}, {27.1, 
     "15"}, {29, "16"}}, None},
 TicksStyle -> {Black, Black, White},
 ViewPoint -> {3, -1.5, 3},
 ImageSize -> Large
 ]

First figure

Another problem i that I'd like to put a z axis in the position of the second image (I've done it changing the code as follows)

 AxesOrigin -> {0, 0, 0}, Axes -> {None, None, Automatic}, 
 AxesStyle -> {None, White, Black},
 TicksStyle -> {None, None, Black},

But to do that, I should move even the numbers because i'm changing even the x and y axes: is there any way to put the z axis in {0,0,0} and the other to axes in another origin (as {30.5, 32.5, 0})?

Figure 2

Thank you all!

2 Replies
Posted 9 years ago

@Yang, This is a helpful post. I notice the last line of the table contains the item func. This answers part of my question why one can write the following, found at ?Ticks.

ticks[min, max] := Table[If[EvenQ[i], {i, i, .06, Red}, {i, i, .02, Blue}], {i, Ceiling[min], Floor[max], 1}]

Graphics[Circle[{0, 0}, 6], Axes -> True, Ticks -> ticks]

The second part of my question was "Where does the function ticks[] get the values that instantiate its arguments?" The min and max values don't show up when OutputForm[] is applied to Graphics or to Circle.

If I find out how to format code in this forum, I will return to edit.

POSTED BY: Gary Palmer

Answer to Question 1: In the documentation of Ticks you can control the length of tick mark with a three-element tuple for each item on the axis

ticklen

Here is an example: I use the ticks on x-axis

ls={{0.5,"1 "},{2.4,"2 "},{4.3,"3"},...};
In[17]:= Map[Append[#,0]&,ls]//Short
Out[17]//Short= {{0.5,1 ,0},{2.4,2 ,0},{4.3,3,0},<<10>>,{25.2,14,0},{27.1,15,0},{29,16,0}}

Use the new list from Out[17] in your code

ticklen

POSTED BY: Shenghui Yang
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract