everybody:
I'm having problems when it comes to representing the data in the form of a histogram.
I do not know very well how to clearly express what I intend, but my idea is:
3 groups of columns (carbides, borides and nitrides)
in each group of columns, 4 columns (hafnium, zirconium, titanium and
tantalum) each with a grid type.
So far, I have done what appears below, but it does not allow me to continue
My current code is:
reset
fontSpec(s) = sprintf("Times-Roman, %d", s)
set term post eps enhanced fontSpec(16)
set output 'TVsG.eps'
set grid
set auto y
set auto x
ticsFont=fontSpec(16)
set xtics font ticsFont
set ytics font ticsFont
set ylabel "Temperature" font fontSpec(25) offset char -1,0
set xlabel "Group" font fontSpec(25) offset 0,char -1
set style fill pattern border -1
set style data histograms
set boxwidth 1.0
set style histogram clustered gap 1
keyFont=fontSpec(18)
set key spacing 2 font keyFont
set key at graph 0.25, 0.9
fn(v) = sprintf("%.1f", v)
plot \
for [COL=2:4] 'data.txt' using COL:xticlabels(1) title columnheader fs
pattern 2, \
'data.txt' u ($0-1-1./6):2:(fn($2)) w labels font fontSpec(14) offset
char 0,0.5 t '' , \
'data.txt' u ($0-1-1./6):2:(fn($3)) w labels font fontSpec(14) offset
char 0,0.5 t '' , \
'data.txt' u ($0-1+1./6):3:(fn($4)) w labels font fontSpec(14) offset
char 0,0.5 t ''
and my data file
Material Hafnium Zirconium Titanium Tantalum
Carbide 3958 3400 3100 3768
Boride 3380 3245 3225 3040
Nitride 3385 2950 2950 2700
The main problem I have now is the following error:
gnuplot> load 'gnuplot2.txt'
"gnuplot2.txt" line 34: warning: Cannot find or open file "data"
"gnuplot2.txt" line 34: warning: Cannot find or open file "data"
"gnuplot2.txt" line 34: warning: Cannot find or open file "data"
"gnuplot2.txt" line 34: warning: Cannot find or open file "data"
"gnuplot2.txt" line 34: warning: Cannot find or open file "data"
"gnuplot2.txt" line 34: warning: Cannot find or open file "data"
"gnuplot2.txt" line 34: No data in plot
Now I'm at a point, I do not know how to continue
Gnuplot does not find the data file. I see two possible reasons:
The name of the datafile is wrong
The script has something like plot "data.txt", the error message mentions a file "data", note the missing .txt. => Check your script and the actual file name, it might be a simple typo or a missing file extension.
The data file is not in the directory where it is expected.
Add the command pwd (print working directory) as the first command in your script. It will print the directory where it expects the data file. If it is not the correct directory, you can:
move or copy your data file to this directory
use the cd command to change to correct directory
start gnuplot from the correct directory
use the plot command with the file name including path information
You use the load command and gnuplot seems to find the script. So I think most probably the data file should be in the same directory as the script gnuplot2.txt.
So far, this is the image that I have
Indeed, the problem was when selecting the directory in which the data was.
The problem now is that I do not know how I can change the format to give it a different color. Besides, I want to add the compound label on top of each column.
Any suggestions?
Related
Our USDZ file won't load on iPhone 7 with iOS 12. It works fine on my iPhone X and iPad Pro, both running iOS 12 Beta.
We've tried creating this using the terminal commands and get the following warning although we don't believe this is the issue.
Warning: in CreateMaterialBindings at line 59 of /BuildRoot/Library/Caches/com.apple.xbs/Sources/3DAssetTools/3DAssetTools-14207.2/external/ModelKit/extern/usd/pxr/usd/usdObj/translator.cpp -- OBJ mtl usemtl name has invalid name '15___Default', using default usemtl name: 'defaultShadeGroup0'
The screen on the iPhone 7 looks as such:
You can download the raw files here.
You can't see your 3D model because you're using very bad naming convention for file model2_$$usd_converter$$_.usdc inside usdz container. In macOS and iOS you have to avoid using $ in file names, because dollar sign is a special character.
Follow these two steps to unzip, rename and rezip your usdz file.
First Step (unzip mmtest.usdz file)
To unzip a usdz file in macOS Mojave use the following method:
In Finder change the extension of .usdz file to .zip.
Uncompress .zip file using Archive_Utility.app or RAR_Extractor.app.
Open unzipped directory and change files' names.
Make sure all textures are in JPG and/or PNG format.
Make sure 3D normals of your USDC model ain't inverted.
Second Step (recreate usdz again)
Make sure that Xcode 10.2 is installed.
To convert a content of unzipped folder (binary usdc file and its textures) to usdz file format again, use the following command in Terminal.app:
cd ~/Desktop/mmtest/
xcrun usdz_converter Model.usdc Model.usdz
-g SofaMesh
-color_map Diffuse.jpg
-roughness_map Roughness.png
-normal_map Normal.jpg
And here are a full list of options (type xcrun usdz_converter -h in Terminal):
-g groupName [groupNames ...] Apply subsequent material properties to the named group(s).
-m materialName [materialNames ...] Apply subsequent material properties to the named material(s).
-h Display help.
-a Generate a .usda intermediate file. Default is .usdc.
-l Leave the intermediate .usd file in the source folder.
-v Verbose output.
-f filePath Read commands from a file.
-texCoordSet set The name of the texturemap coordinate set to use if multiple exist (no quotes).
-opacity o Floating point value 0.0...1.0
-color_default r g b a Floating point values 0.0...1.0
-normal_default r g b a Floating point values 0.0...1.0
-emissive_default r g b a Floating point values 0.0...1.0
-metallic_default r g b a Floating point values 0.0...1.0
-roughness_default r g b a Floating point values 0.0...1.0
-ao_default r g b a Floating point values 0.0...1.0
-color_map filePath
-normal_map filePath
-emissive_map filePath
-metallic_map filePath
-roughness_map filePath
-ao_map filePath
Now model works perfectly.
I am trying to plot two column data. using first column as label of x axis (configuration) and and the seconds column as the value for the y axis(average_ mpki).
This is how my data looks like:
#assoc_valr blk_sz, cache_sz, rep_pol, avg_icache_mpki
4a128b32c1r 0.000682
4a128b32c2r 3.030329
4a128b16c1r 0.0333616
4a128b16c2r 0.0307207
4a64b32c1r 0.0125913
This is my ploting script:
# Gnuplot script file for plotting data in file "confs.out"
# This file is called confs.p
set style data histogram
set style fill solid border -1
filename="confs.out"
set boxwidth 0.15
set xlabel "Configurations"
set ylabel "Average MPKI"
set xtic rotate by -45 scale 0
set output "confs.png"
set terminal png size 1200,1200
plot "<(sed -n 'confs.out')" using 2:xtic(1) with histogram
I try plotting but it doesn't work, It doesn't throw any warning or error message but still it doesn't generate the output file for me. I can't see output when I try ploting without using the script also. I tried to gather windows to see if it is hidden under my terminal but it is not.
I also tried replacing the space separator with the tab in the data. Still not working.
gnuplot> load 'confs.p'
^C
gnuplot> plot 'confs.out' using 2:xtic(1) with hist
gnuplot> exit
I have a sequence of 1500 data files named like: 1.dat, 2.dat.....1500.dat, and I want to use gif terminal in gnuplot to make a gif file. I wrote a script to do this, which works pretty good if the number of the data file is not too large. When I tried to make a gif file using 1500 datafiles, the output is a broken file that can not be opened
I post my code as follow, the out.plt file is used to set up gif terminal and then load "loop.plt"; "loop.plt" is used to looping over all the data files:
#start of out.plt file
#This is used to load the loop file
#set up basis config
i=1
n=1500
set title "Suppressing Spiral Wave with Planar Wave"
set size ratio 1
set terminal gif animate delay 15 loop 1500
set output "control_spiral1.gif"
load "loop.plt"
set output
#end of out.plt file
and here is the loop.plt file:
#start of loop.plt
#This is the loop file to plot all data files
set pm3d map
set palette gray
splot sprintf("%d.dat",i) matrix
i=i+1
if(i<=n) reread
#end of loop.plt
I would like to automate the generation of graphs from a list of data files.
More details :
I have a directory that contain all my data files. I need to generate a graph for each of these files (hundreds). I have a gnuplot file to generate one graph but the name of the data file is specified into the gnuplot script.
For example :
plot 'myfile' index 1 using 1:2 with linespoints pointtype 2 linecolor rgb "green" title "leg"
I need to be able to replace "myfile" by a variable name that can be iterated on all the files of my directory.
You could have a (Windows) batch file with the following command:
for %%G in (*.dat) do gnuplot.exe -e "fn='%%G'" script
This will run gnuplot (and script) for every .dat file in the current directory.
The -e switch is used to input variables via command line (here the filename, surrounded by quotes in case it contains spaces).
If you want to run this command directly from the shell (as opposed to within a batch file), remove one of the % symbols from each of the two pairs.
Within the script file:
plot fn index 1 using 1:2 with linespoints pointtype 2 linecolor rgb "green" title "leg"
If the data files have a "normalized" name (e.g. data1.dat, data2.dat...) take a look at https://stackoverflow.com/a/14947085/3235496
In general you can iterate over many files inside gnuplot as follows:
set terminal pdfcairo
list = "fileA fileB fileC"
do for [file in list] {
set output file . '.pdf'
plot file
}
That kind of iterations requires at least version 4.6.0. In this example you have a fixed list of file names (these are not allowed to contain white spaces).
On Windows you could use
list = system('dir /b *.txt')
to get such a list containing all .txt files in the current directory. Note, that you must use wgnuplot_pipes.exe for this to work.
On a Unix system you could use
list = system('ls *.txt')
I have gnuplot(version 4.6 patchlevel 5) on Windows 8. I would like to set encofing utf8. I save my source in UTF8 encoding. My source test.txt:
set terminal pdf enhanced size 16cm,8cm font ", 10"
set output "Slozitost/Slozitost.pdf"
set encoding utf8
set grid
set datafile separator ","
set title "Složitost" font ",10"
set key left top title "Legenda" box
set xdata time
set timefmt "%d/%m/%Y"
set xrange ["03/01/2009":"20/04/2014"]
set format y "%10.0f"
#set yrange [-50:14000000]
set format x "%m/%y"
set xtics 6*30*24*60*60
#set ytics 100
set lmargin 13
set rmargin 2
set style fill transparent solid 0.5 noborder
plot 'Slozitost.csv' using 1:2 title "Slozitost" with lines linecolor rgb "blue" lw 3
I tried compile source by gnuplot terminal. Gnuplot terminal said to me this error:
gnuplot> load "test.txt"
^
"test.txt", line 1: invalid character »
What is wrong??
I think this happens if your file has a BOM marker at the beginning. Gnuplot cannot handle this. To remove that, see the documentation of your editor.
If this is the source of the error, the code should work fine if you copy and paste it into the interactive terminal.
BTW: There is no need to post such a big script which we cannot run (we don't have the data file). A minimal script which could show the problem would be something like
set encoding utf8
plot x title "Složitost"
which would also narrow down the source of your problem :)