Re: listplot and notebook directory
- To: mathgroup at smc.vnet.net
- Subject: [mg15397] Re: listplot and notebook directory
- From: Rolf Mertig <rolf at mertig.com>
- Date: Tue, 12 Jan 1999 03:14:57 -0500
- Organization: Mertig Research & Consulting
- References: <779bkt$b7o@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Maarten.vanderBurgt at icos.be wrote: > > Hello, > > I have two unrelated questions: > > 1. LISTPLOT > > When I execute the following command the result is a listplot where the > data points ares fairly big filled black circles. > In[1]:= ListPlot[{0,2,4,9,16,25},PlotStyle->PointSize[0.05]] > > The following gives a plot where the data points are joined by a line. > In[2]:= ListPlot[{0,2,4,9,16,25},PlotJoined -> True] > > With the following I would expect the combination of the two. It does > however give the same results as In[2]: the > "PlotStyle->PointSize[0.05]" options doesn't seem to have any effect > here. Is this intended behaviour or is this a bug? > In[3]:= ListPlot[{0,2,4,9,16,25},PlotJoined -> True, > PlotStyle->PointSize[0.05]] > > Is there a way you can have both options "PlotJoined -> True" and > "PlotStyle->PointSize[0.05]"? > > 2. NOTEBOOK DIRECTORY > > Is there a command which gives the directory where the current notebook > resides? > > You get the notebook directory -- which can be some network directory > different from the local directory where Mathematica is located -- with > $InitialDirectory when you start Mathematica by double clicking on the > notebook file in Explorer (Windows). However, when Mathematica is > launched from the programs menu and you open the same notebook from the > File menu, $InitialDirectory gives the Mathematica directory. Is there > a command which also in the latter case gives the path to the notebook? > I did not find anything in the book. This would be very usefull when > you want to read in data from an ascii file which sits in the same > directory as the notebook file. It would make moving the whole > directory much easier: you would not have to retype a fairly long > network directory path. > > Thanks for any help > > Maarten van der Burgt > > Icos Vision Systems > Leuven > Belgium The important function is NotebookInformation[ notebookobject ]. Executing NotebookInformation[InputNotebook[]] will give you all kind of useful information. For getting the directory you can use NotebookDirectory[ InputNotebook[] ] , which will give you the directory. I'm not 100% sure it will work over the network though. Please let me know. I'll also list NotebookFileName which I found useful too. Options[NotebookFileName] = {Directory -> True}; winfix[x_] := If[StringMatchQ[$OperatingSystem, "Windows9*"], x /. s_String :> StringDrop[s, 1] /; StringMatchQ[StringTake[s, 1], $RootDirectory], x]; NotebookFileName[nb_ /; Head[nb] === NotebookObject, opts___] := winfix[If[(Directory /. Flatten[{opts, Options[NotebookFileName]}]) === True, "FileName" /. NotebookInformation[nb] /. FrontEnd`FileName[d_, f_, ___] :> ToFileName[d, f], "FileName" /. NotebookInformation[nb] /. FrontEnd`FileName[d_, f_, ___] :> f] /. "FileName" -> $Failed]; NotebookDirectoryName[nb_ /; Head[nb] === NotebookObject] := winfix["FileName" /. NotebookInformation[nb] /. FrontEnd`FileName[d_, __] :> ToFileName[d] /. "FileName" -> $Failed]; Rolf -- Dr. Rolf Mertig Mertig Research & Consulting Mathematica training and programming Development and distribution of FeynCalc Amsterdam, The Netherlands http://www.mertig.com