Enviar gráficos 3D pela janela de chat no Kopete

Publicado por Júlio Hoffimann Mendes (última atualização em 10/08/2010)

[ Hits: 4.809 ]

Download Plot3d.sh




O script permite enviar gráficos 3D para um contato do Kopete especificado. Para maiores informações, consulte a versão 2D aqui no VOL.

Assim como naquela versão, os comandos do Gnuplot foram escritos no próprio script para facilitar alterações e evitar arquivos de configuração desnecessários numa aplicação tão simples. Perceba que alguns desses comandos estão comentados, caso você queira testar outras aparências que julguei interessantes.

Obs.: Ao alterar as configurações do Gnuplot no script, lembre-se que existem dois campos: remetente e destinatário.

Como usar o script:

1ª Maneira-> Na janela de chat, ao conversar com Richard Stallman (nickname), escreva:

/exec Plot3d.sh 'sin(x)*cos(y)' -pi pi -pi pi 10 'Richard Stallmann'

2ª Maneira-> Também é possível especificar a conta para qual você deseja mandar o gráfico, por exemplo:

/exec Plot3d.sh 'x**2-y**2' -10 10 -10 10 10 'richard.stallman@freesoftware.org'

O último argumento numérico está associado ao refinamento do gráfico, geralmente 10 é suficiente. Se divirtam e mostrem o poder do Linux para os seus contatos. =)

  



Esconder código-fonte

#!/bin/bash

# Plot3d.sh sends 3D plots to specified Kopete contact
# Copyright (C) 2010  Júlio Hoffimann Mendes
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
# ----------------------------------------------------------------------
#
# Dependencies: gnuplot
# Description: send 3D plots to specified Kopete contact
# Usage: Plot3d.sh <f(x,y), g(x,y),..., h(x,y)> xmin xmax ymin ymax samples AccountID
# samples is associated to the number of points to be plotted for each x and y axis, generally 10 is sufficient
# Example: Plot3d.sh 'x**2-y**2' -10 10 -10 10 10 'richard.stallman@freesoftware.org'
# OBS: AccountID could be MetaContactID, for example 'Richard Stallman'

# gnuplot file with plot specifications
SPECS=`tempfile`

FIGURE=`tempfile --prefix Plot- --suffix .png`

# ===================================
# Destinatary Plot Specifications
# ===================================
echo "
reset;
set term png;
set xrange [$2:$3];
set yrange [$4:$5];
set autoscale zmin;
set autoscale zmax;
# set samples 400;
set isosamples $6;
set grid;
set pm3d;
# set palette defined ( 0 \"cyan\", 1 \"white\", 2 \"red\" );
# set hidden3d;
set contour;
set cntrparam levels auto 10;
unset clabel;
set colorbox front;
set title \"Seja livre, use Linux!\";
splot $1 with lines lc rgb \"#d3d3d3\";
# splot $1 with pm3d lc rgb \"#d3d3d3\";
" > $SPECS
# make figure
gnuplot $SPECS > $FIGURE
# send it to specified contact
qdbus org.kde.kopete /Kopete org.kde.Kopete.sendFile "$7" $FIGURE
# ===================================
# Remetent Plot Specifications
# ===================================
echo "
reset;
set xrange [$2:$3];
set yrange [$4:$5];
set autoscale zmin;
set autoscale zmax;
# set samples 400;
set isosamples $6;
set grid;
set pm3d;
# set palette defined ( 0 \"cyan\", 1 \"white\", 2 \"red\" );
# set hidden3d;
set contour;
set cntrparam levels auto 10;
unset clabel;
set colorbox front;
set title \"Seja livre, use Linux!\" font \"Times,18\";
splot $1 with lines lc rgb \"#d3d3d3\";
# splot $1 with pm3d lc rgb \"#d3d3d3\";
" > $SPECS
# plot function(s) on a float window to remetent
gnuplot -persist $SPECS

rm $SPECS

Scripts recomendados

Removendo arquivos com primeiro caracter especial

Limpar memoria

SonyEricson-MD300 funciona

Instalador automatizado SAMBA 4 AD e File Server CentOS 7

Twitter via shell


  

Comentários

Nenhum comentário foi encontrado.


Contribuir com comentário




Patrocínio

Site hospedado pelo provedor RedeHost.
Linux banner

Destaques

Artigos

Dicas

Tópicos

Top 10 do mês

Scripts