Message Boards Message Boards

0
|
6662 Views
|
13 Replies
|
0 Total Likes
View groups...
Share
Share this post:

ScientificForm and bounding box question

Posted 3 years ago

Hi. I hope you are ok about Covid.

I would appreciate your help.

My questions are: 1-Is there any way that ScientificForm shows 1.0 instead of 1.? 2-Unfortunately, when I am using plot 3D the axes labels are overlapped with the numerical data on the axes. Is there any way to separate the axes label from numerical data? I need to export this image so I can’t use Time Bounding Box as far as I know. In other words, How can I use in Graphic 3D Trim Bounding Box automatically?

13 Replies
Posted 3 years ago

Not sure exactly what you mean by "Bounding Box". You should have provided an example. Try the ImagePadding option, or Method -> {"ShrinkWrap" -> True}.

POSTED BY: Rohit Namjoshi

Hi, -Unfortunately, when I am using plot 3D the axes labels are overlapped with the numerical data on the axes hence I have to start rotating the graph until I find a position which axes labels and numerical data are not overlapped but I can’t use this method because I need to export the graph using Rasterize to change dpi image. Is there any way to separate the axes label from numerical data automatically? Regards.

Have you tried to use the option Ticks to change their count on the axis? this can help with your bounding box issue.

Also posting your code (formatted) and the output can help.

POSTED BY: Ahmed Elbanna
Posted 3 years ago

There is nothing to undo. You can use the original function or the alternative function depending on what you need.

POSTED BY: Mike Besso
Posted 3 years ago

The technique I used allows you to create alternative functions for existing functions, but with a different set of default options. So, if the original function's options allow you to do something, then this technique will allow you to make that the default setting for the alternative function.

Of course, you can always go further than just changing default options.

As for ticks on plots, check out this post on the topic.

POSTED BY: Mike Besso

Thank you so much for your time. I have a last question: Just in case, How can I undo your method ?

Posted 3 years ago

You can always define your own reusable form functions. It is a bit tedious to get started, but after you use the reusable functions a few times, you start to realize the efficiencies.

This is an approach that I'm currently using:

First, create function that allows me to override the rules in options (or any other list of rules). This will allow me to use while overriding existing options from other functions.

Clear[overrideRuleInList];

overrideRuleInList[rules_ : {Rule ...}, overrides_Association] := 
  Join[Association[rules], overrides] // Normal;

overrideRuleInList[rules_ : {Rule ...}, overrides_ : {Rule ...}] := 
  overrideRuleInList[rules, Association[overrides]];

overrideRuleInList[rules_ : {Rule ...}] := rules;

Second, define an alternate form function that uses a new set of default options.

    Clear[sciForm]; 

    Options[sciForm] = overrideRuleInList[
        Options[ScientificForm], 
        <|NumberPadding -> {"", "0"}|>
    ];

    sciForm[value_?NumericQ, opt : OptionsPattern[]] := ScientificForm[
        value, {2, 1},  
        Sequence[overrideRuleInList[Options[sciForm], opt]]
    ];

While the above pattern works, it still feels a little bit like a hack. I'd love to hear how others in the community handle reusable utility functions like this.

POSTED BY: Mike Besso

Hi, it is other level to me. Jajaja Thank you for your help.

Does this code make that ScientificForm shows always as the first decimal value as zero or make that ScientificForm recognizes the zeros?

I am working with numbers with decimal values but they don’t have always their first decimal value as zero. Besides, I am using plot and I need to express the axes in scientific notation for thisI am using Ticks. I don’t know if there is any other form to make the plot in Scientific form. Regards.

Posted 3 years ago

I have tried with last command and it works! Though this is a manual way, is there any way that ScientificForm includes decimal values equal zero? Thanks

POSTED BY: Updating Name
Posted 3 years ago
ScientificForm[100000., {2, 1}, NumberPadding -> {"", "0"}]
POSTED BY: Hans Milton
Posted 3 years ago

Wow, this works well! thank you to you :)

POSTED BY: Yasmin Hussain

I have tried PaddedForm but it is not compatible with ScientificForm. I need to obtain 1.0•10^n instead of 1.•10^n. ScientificForm excludes decimal values equal zero. Thanks for your help Regards

You can try PaddedForm[1., {2, 1}], or some variation thereof.

POSTED BY: Gianluca Gorni
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