Re: How to specify x-axis in List when using ListPlot

• To: mathgroup at smc.vnet.net
• Subject: [mg127877] Re: How to specify x-axis in List when using ListPlot
• From: Bob Hanlon <hanlonr357 at gmail.com>
• Date: Wed, 29 Aug 2012 01:13:05 -0400 (EDT)
• Delivered-to: l-mathgroup@mail-archive0.wolfram.com
• Delivered-to: l-mathgroup@wolfram.com
• Delivered-to: mathgroup-newout@smc.vnet.net
• Delivered-to: mathgroup-newsend@smc.vnet.net
• References: <20120828085322.A005168D4@smc.vnet.net>

```data1 =
{{1, 8, 9, 1}, {2, 2, 8, 1}, {3, 8, 9, 2},
{4, 3, 7.5, 2}, {5, 3, 7.5, 1}};

Module[{
labels =
Style[#, Bold] & /@
{"Test", "Variable 1", "Variable 2", "Result "},
minResult = Min[data1[[All, 4]]],
maxResult = Max[data1[[All, 4]]]},
Graphics3D[{
AbsolutePointSize,
{ColorData["TemperatureMap"][
Rescale[#[[-1]], {minResult, maxResult}]],
Point[Rest[#]]} & /@
data1},
BoxRatios -> {1, 1, 1/GoldenRatio},
Axes -> True,
AxesLabel -> Rest[labels],
PlotLabel -> Style["TEST RESULTS\n", Bold],
ImageSize -> 400]]

Or with some embellishments:

Module[{
labels =
Style[#, Bold] & /@
{"Test", "Variable 1", "Variable 2", "Result "},
minResult = Min[data1[[All, 4]]],
maxResult = Max[data1[[All, 4]]]},
Panel[
Column[{
Graphics3D[{
AbsolutePointSize,
{ColorData["TemperatureMap"][
Rescale[#[[-1]], {minResult, maxResult}]],
Tooltip[
Point[Rest[#]],
"Test " <> ToString[First[#]] <>
"\nVar = " <>
ToString[#[[{2, 3}]]] <>
"\nResult = " <>
ToString[Last[#]]]} & /@
data1},
BoxRatios -> {1, 1, 1/GoldenRatio},
Axes -> True,
AxesLabel -> Rest[labels],
PlotLabel -> Style["TEST RESULTS\n", Bold],
ImageSize -> 400],
Grid[Prepend[data1, labels],
Frame -> All,
Background -> Lighter[Gray, .75]]},
Alignment -> Center]]]

Bob Hanlon

On Tue, Aug 28, 2012 at 4:53 AM, Jack Heanult <john.h.hayden at gmail.com> wrote:
>
>
> I have imported a csv file into a list with this stmt:
>
> data1 = Take[Import["D:\_reports\optim_5_60_b_2.csv", "CSV"], 5]
>
> Which gives:
>
> {{1, 8, 9, 1}, {2, 2, 8, 1}, {3, 8, 9, 2}, {4, 3, 7.5, 2}, {5, 3, 7.5, 1}}
>
> I would like to create a plot where the x-axis is based on the first field:
>
> 1,2,3,4,5
>
> And the plot creates a line for each subsequent field, so the 2nd fields are:
>
> 8,2,8,3,3 and this would be plotted as a line.
>
> This would be the first line on the y-axis, the other y-axis values would be plotted in the same manner. I would like the first y-plot to be plotted in red, and the second in blue, and the third in green with chart labels.
>
> Just to get it to plot I have tried:
> tobeplotted =  With[{LocalX = data1[[All, 1]]},
>    Transpose[{LocalX, #}] & /@ Transpose[data1[[All, 2 ;;]]]]
>
> ListPlot[tobeplotted, PlotStyle -> {Red, Blue, Green},  PlotMarkers -> {Automatic, 10}]
>
> But the resulting plot is not what I want.
>
> The first column in the csv file is the 'test number' (1) the 2nd(8), 3rd (9), are the test variables, and the 4th(1) column is the result. I would like to see how the test results vary as the variables change. Perhaps ListPlot is not what I want, it was my thought just to see something similar to what I can do in a Excel graph.
>
> Any help is most appreciated.
>

```

• Prev by Date: reduction/simplification of hypergeometric-function-related formula
• Next by Date: Find a maxlist of within subsets
• Previous by thread: How to specify x-axis in List when using ListPlot
• Next by thread: Re: How to specify x-axis in List when using ListPlot
{"ft_lang_label":"__label__en","ft_lang_prob":0.7134675,"math_prob":0.8344098,"size":3306,"snap":"2023-40-2023-50","text_gpt3_token_len":1131,"char_repetition_ratio":0.09115688,"word_repetition_ratio":0.25285172,"special_character_ratio":0.38566244,"punctuation_ratio":0.25034964,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9558086,"pos_list":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14],"im_url_duplicate_count":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2023-12-04T19:04:34Z\",\"WARC-Record-ID\":\"<urn:uuid:926edc9e-5342-461b-ac50-e98ed42a7186>\",\"Content-Length\":\"47607\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:d289e461-f0a3-4d16-9f02-396bda2cfd19>\",\"WARC-Concurrent-To\":\"<urn:uuid:75f86f04-947c-4f82-ba46-e7832968b800>\",\"WARC-IP-Address\":\"140.177.9.73\",\"WARC-Target-URI\":\"https://forums.wolfram.com/mathgroup/archive/2012/Aug/msg00398.html\",\"WARC-Payload-Digest\":\"sha1:JFSMGECMHCU7KSUIPI7YCF3GWOH3BP3Z\",\"WARC-Block-Digest\":\"sha1:ZJ77JJ73OSUNFR5UJLXBDMVZQWHZLBC3\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2023/CC-MAIN-2023-50/CC-MAIN-2023-50_segments_1700679100534.18_warc_CC-MAIN-20231204182901-20231204212901-00565.warc.gz\"}"}