Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2004
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2004

[Date Index] [Thread Index] [Author Index]

Search the Archive

RE: one question about draw graph in frame

  • To: mathgroup at smc.vnet.net
  • Subject: [mg49028] RE: [mg49001] one question about draw graph in frame
  • From: "David Park" <djmp at earthlink.net>
  • Date: Tue, 29 Jun 2004 04:50:00 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Daohua,

I don't think I completely understand your question, especially given your
example. Are you trying to obtain tick labels at a set of irregular values,
or are you trying to obtain different scales on the top and right of the
frame? (For example you may want to label in meters on the bottom and in
feet on the top.)

In any case, you will have to specify the tick values that you want, either
by a Table or by a list of values. In the Graphics`Graphics` package there
are the functions: LinearScale, LogScale, PiScale and UnitScale that are
useful for automatically generating tick values - but not for the example
you give.

I agree that it is a chore to completely specify the ticks for a full frame
in detail. One of the problems is getting the unlabeled ticks as well as the
labeled ones. If you are using the same scale up-down and/or left-right then
you want the same tick marks but unlabeled up and right.

The DrawGraphics package at my web site below has a command CustomTicks that
will generate tick marks. It allows you to use scales that are a function of
the actual plot scale so you could have different scales up-down or
left-right. You can generate linear, log and databased tick values. Via
options you can specify the look of the tick marks and the form of the
labels.

Here is your plot using databased CustomTicks. The scale function in this
case is Identity since we are using the actual plot values. The up and right
ticks use a null string to format the values, which means they are left
blank. We need to specify the up and right ticks so they match up-down and
right-left. (Automatic would use the regular Mathematica ticks that would
not match.)

Needs["DrawGraphics`DrawingMaster`"]

Draw2D[
    {Draw[x^2, {x, 0, 1}]},
    Frame -> True,
    FrameTicks -> {
        CustomTicks[Identity, databased[{0, 0.5, 0.7, 1}]],
        CustomTicks[Identity, databased[{0, 0.5, 1}]],
        CustomTicks[Identity, databased[{0, 0.5, 0.7, 1}],
          CTNumberFunction -> ("" &)],
        CustomTicks[Identity, databased[{0, 0.5, 1}],
          CTNumberFunction -> ("" &)]},
    ImageSize -> 500];

Making a nice graph is as much a work of art as a science. If you don't want
to go with the set-piece plots you will have to tend to the details. But you
could define a plot function that has all the custom work in it and all you
do is feed in the data for each separate plot.

David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/



From: Daohua Song [mailto:ds2081 at columbia.edu]
To: mathgroup at smc.vnet.net

Dear group,
      i draw a graph in frame model and can use framticks to let the upper
and right have some scale you want. My question is that if it is possible
to let the mathematics to do it automatically? you know, to write down
every ticks is annoying.
      e.g
      \!\(Plot[x\^2, {x,
      0, 1}, Frame -> True, FrameTicks -> {{0,  .5,  .7, 1}, {0,  .5,
1}}]\)
      Any suggestion will be appreciated!
daohua




  • Prev by Date: File reference in Front End
  • Next by Date: Re: Simplifying with assumptions
  • Previous by thread: RE: one question about draw graph in frame
  • Next by thread: Re: one question about draw graph in frame